preventDefault()

2017-06-16 17:33:00
admin
原创
507
<!DOCTYPE html>
<html>
<head>
    <title>Cross-Browser Event Object Example</title>
    <script type="text/javascript" src="EventUtil.js"></script>
</head>
<body>
    <a href="http://www.nczonline.net/" id="myLink">Click Me</a>
    <p>This link will not navigate when clicked.</p>
    <script type="text/javascript">
        var link = document.getElementById("myLink");
        link.onclick = function(event){
            event = EventUtil.getEvent(event);
            EventUtil.preventDefault(event);
        };    
    </script>
</body>
</html>
  • QQ讨论群
  • 关注微信
    • 欢迎咨询
    • 欢迎加入QQ群 16506021
  • 公众号:源宝网络