Js_事件介绍

来源:岁月联盟 编辑:exp 时间:2012-03-29
点击事件
[html]
1. <body> 
2. <input type="button" value="点我" onclick="acert("button");" /> 
3. <a href="javascript:alert('hello')">点击我显示Hello</a>//超链接的href中加入js才需要加"javascript:",因为他不是事件,而是把“javascript:”看成像“http:”、“ftp:”一样的网络协议 
4. <a href="无效.html" onclick="alert('hello2')">点我显示hello2</a>//先触发onclick,再导向至无效.html 
5. </body> 
 
 摘自  Click Here