先來看一下Js和Jquery的點(diǎn)擊事件
舉兩個(gè)簡單的例子
<!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>無標(biāo)題文檔</title> <script src="jquery-1.11.2.min.js"></script> </head> <body> <input type="button" value="測試" onclick="test()" /> <input type="button" value="測試2" id = "btn" /> </body> <script type="text/javascript">function test() { alert("aa"); } $(document).ready(function(e) { $("#btn").click(function(){ alert("第二個(gè)按鈕"); }) });</script> </html>