随笔 - 2, 文章 - 1, 评论 - 3, 引用 - 0
数据加载中……

超链标签响应onclick事件时,防止页面跳动方法

         点击一个<a>链接时,有垂直滚动条的话页面会跳到顶端,so google it, and then finally found some ways:(sorry, i forgot the author.)
       方法1:

<href="#" onclick="test();return false">click me</a> 
       方法2:
<href="javascript:void(0)" onclick="test()">click me</a> 

 

posted on 2012-04-07 14:59 Fly Without Wind 阅读(3069) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: