终止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法

<a>停止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法

<a href="javascript:void(0);">

 

#包含了一个位置信息

默认的锚点是#top 也就是网页的上端

而javascript:void(0)  仅仅表示一个死链接

这就是为什么有的时候页面很长浏览链接明明是#可是

跳动到了页首

而javascript:void(0) 则不是如此

所以调用脚本的时候最好用void(0)

或者<input onclick>

<div onclick>等

打开新窗口链接的几种办法

1.window.open('url')

2.用自定义函数

<a>终止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法        <script>
<a>终止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法        
function openWin(tag,obj)
<a>终止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法        
{
<a>终止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法            obj.target
="_blank";
<a>终止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法            obj.href 
= "Web/Substation/Substation.aspx?stationno="+tag;
<a>终止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法            obj.click();
<a>终止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法        }

<a>终止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法        
</script>

 

<a>终止在当前页,a href=#与 a href=javascript:void(0) 的区别 打开新窗口链接的几种办法< href="javascript:void(0)" onclick="openWin(3,this)">株洲</a>


window.location.href=""