jquery学习2
简单看看api 做些小例子理解
1:
------------------------------------------------------
jQuery(expression,[context])
expression (String) : 用来查找的字符串
context (Element, jQuery) : (可选) 作为待查找的 DOM 元素集、文档或 jQuery 对象。(控制范围)
----------------------
<script type="text/javascript" src="../js/jquery-1.3.1.js"> </script>
<script type="text/javascript">
window.onload=function (){
//jQuery(expression,[context])
alert($("#list",$("#newList1")).size());
}
</script>
</head>
<body>
<ul id="newList1">
<li id="list">List1</li>
<li id="list">List2</li>
<li>List3</li>
<li id="list">List4</li>
</ul>
<ul id="newList2">
<li id="list">List1</li>
<li id="list">List2</li>
<li>List3</li>
<li id="list">List4</li>
</ul>
</body>
====================================================================
2:jQuery(elements)将一个或多个DOM元素转化为jQuery对象。
---------------------------------------------------
$(document.body).css( "background", "black" );
$(myForm.elements).hide() ;
-----
window.onload=function (){
$(document.body).css("width","800px");
$(document.body).css("height","600px");
$(document.body).css("border","1px solid red");
}
====================================================================