码迷,mamicode.com
首页 > 编程语言 > 详细

href="javascript:"和href="javascript:void(0);"

时间:2015-08-05 14:25:11      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:

Javascript代码  
  1. 技术分享<a onclick="fn()">Does not appear as a link, because there‘s no href</a>  
  2. <a href="javascript:void(0)" onclick="fn()">fn is called</a>  
  3. <a href="javascript:undefined" onclick="fn()">fn is called</a>  
  4. <a href="javascript:" onclick="fn()">fn is called too!</a>  这三个是等价的。

href="javascript:"和href="javascript:void(0);"

标签:

原文地址:http://www.cnblogs.com/zhuni/p/4704424.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!