测试代码:
09-表单选择器.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>09-表单选择器.html</title> 6 <!-- 引入jQuery --> 7 <script src="../js/jquery-1.4.2.js" type="text/javascript"></script> 8 <script type="text/javascript"> 9 //<![CDATA[ 10 $(document).ready(function(){ 11 alert($("#form1 :text").length); 12 }); 13 //]]> 14 </script> 15 </head> 16 <body> 17 <form id="form1" action="#"> 18 <input type="button" value="Button"/><br/> 19 <input type="checkbox" name="c"/>1<input type="checkbox" name="c"/>2<input type="checkbox" name="c"/>3<br/> 20 <input type="file" /><br/> 21 <input type="hidden" /><div style="display:none">test</div><br/> 22 <input type="image" /><br/> 23 <input type="password" /><br/> 24 <input type="radio" name="a"/>1<input type="radio" name="a"/>2<br/> 25 <input type="reset" /><br/> 26 <input type="submit" value="提交"/><br/> 27 <input type="text" /><br/> 28 <select><option>Option</option></select><br/> 29 <textarea rows="5" cols="20"></textarea><br/> 30 <button>Button</button><br/> 31 32 33 </form> 34 35 <div></div> 36 <!-- Resources from http://down.liehuo.net --> 37 </body> 38 </html>