Jquery在指定元素内查找元素(相对定位)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" src="Scripts/jquery-1.6.2.js"></script>
    <script type="text/javascript">
        $(function () {
            $("ul", $("div:last")).css("background-color","orange");
        });
    </script>
</head>
<body>
    <div>
        <ul>
            <li>11</li>
            <li>11</li>
            <li>11</li>
            <li>11</li>
            <li>11</li>
            <li>11</li>
        </ul>
    </div>
    <div>
        <ul>
            <li>22</li>
            <li>22</li>
            <li>22</li>
            <li>22</li>
            <li>22</li>
            <li>22</li>
        </ul>
    </div>
</body>
</html>
posted @ 2012-06-26 15:19  ``炯``  阅读(2780)  评论(0编辑  收藏  举报