1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <form action="" method="get" id="f"> <input type="text" placeholder="请输入文本" id="i1"/> <input type="checkbox" id="i2"/> <input type="submit" value="提交"/> <input type="reset" value="重置"/> </form> </body> </html>
<script type="text/javascript">
i1.onfocus = function(){
} i2.onfocus = function(){ console.log("复选框获取焦点!!") } i1.onblur = function(){
} f.onsubmit = function(){ alert("哈哈哈哈哈哈哈哈哈哈或或"); } f.onreset = function(){ alert("重置按钮!!!"); } i1.onchange = function(){ console.log("值改变啦!!!"); } </script>
|