表单选择器主要包含内容:
代码如下:
1 <%@ page language="java" import="java.util.*" 2 pageEncoding="utf-8"%> 3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 4 <html> 5 <head> 6 <title>11</title> 7 <script type="text/javascript" src="js/jquery-1.11.0.js"> 8 </script> 9 <script language="javascript"> 10 $(document).ready(function() 11 { 12 alert("欢迎来到页面"); 13 14 //***********************弹出button的个数******** 15 var $buttons=$(":button");//获取所有表单元素:radio,:reset等 16 alert($buttons.length); 17 //备注:$("input[type='button']")不能选中<button></button> 18 }); 19 20 //****************************************************** 21 </script> 22 </head> 23 <body> 24 <form> 25 <input type="button" id="bt1" value="按钮1" ></input> 26 <input type="checkbox" class="bt2" value="" ></input> 27 <input type="text" id="bt3" value="" ></input> 28 <input type="image"></input> 29 <input type="password"></input> 30 <input type="radio"/> 31 <input type="image">兔兔</input> 32 <input type="reset"/> 33 <input type="submit"/> 34 <input type="text"/> 35 <input type="hidden"/> 36 <input type="file"></input> 37 <button >按钮2</button> 38 </form> 39 <div id="div1" style="background:grey;border:1px solid;20%;height:30%;float:left">div1</div> 40 <div class="div2" style="background:white;border:1px solid;20%;height:30%;float:left"><p>p1第一段</p>p2第二段<p></p></div> 41 <br> 42 </body> 43 </html>