链接<a href="javascript:void(0)" />

1、<a href="#"></a>——点击链接后,页面会向上滚到页首,# 默认锚点为 #TOP

2、<a href="javascript:void(0)" onClick="window.open()"> 点击链接后,页面不动,只打开链接

//点击页面不动
1:<a href="####"></a> 
2:<a href="javascript:void(0)"></a>
3:<a href="javascript:void(null)"></a>
4:<a href="#" onclick="return false"></a>

3、打开窗口链接的几种方式

    3.1 window.open("url"); 详见:http://www.w3school.com.cn/jsref/met_win_open.asp      http://www.cnblogs.com/stswordman/archive/2006/06/02/415853.html

    3.2 window.location.href="url"; 详见:http://www.w3school.com.cn/jsref/dom_obj_location.asp

    3.3 自定义函数       

   <script type="text/javascript">
         function openWin(obj) {
             obj.target = "_blank";
             obj.href = "https://www.baidu.com/?tn=sogouie_dg";
             obj.click();
         }
        </script>
<a href="javascript:void(0)" onclick="openWin(this)">LINK_TEST</a>
View Code

    3.4 <a href="url" target="_blank|_parent|_self|_top"></a>——详见:http://www.w3school.com.cn/tags/tag_a.asp

    3.5 <link rel="stylesheet" type="text/css" href="theme.css"/> ——链接外部资源  http://www.w3school.com.cn/tags/tag_link.asp

    3.6 <nav></nav>——定义导航链接的部分,html5 http://www.w3school.com.cn/tags/tag_nav.asp

 

 

原文地址:https://www.cnblogs.com/myboke/p/4629110.html