JS案例:阻止事件的默认行为
来自CloudWiki
<!doctype html> <html> <head> <meta charset="utf-8"> <title>阻止事件的默认行为示例</title> <script type="text/javascript"> function preventLink() { if(event.srcElement.tagName.toUpperCase()=="A" && event.shiftKey) { event.returnValue = false; //取消事件的默认处理动作 //return false; } } </script> </head> <body onclick="return preventLink()"> <p><a href="http://www.ryjiaoyu.com/">人邮社区主页</a></p> </body> </html>