点击链接不做任何事情:
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" onclick="return false">test</a>
<a href="javascript:void(0);" rel="external nofollow" >test</a>
<a href="javascript:void(null)" rel="external nofollow" >test</a>
<a href="javascript:;" rel="external nofollow" >test</a>
<!-- 使用2个到4个#,见的大多是"####",也有使用"#all"等其他的 -->
<a href="####" rel="external nofollow" >test</a>
<!-- 好像在FF中不能显示 -->
<span style="cursor:hand">test</span>
点击链接后,响应用户自定义的点击事件:
<!-- 这里表示这个链接不做跳转动作,执行onClick事件 -->
<a href="javascript:void(0);" rel="external nofollow" onclick="alert('ok');"></a>
<!-- 这里表示这个链接不做跳转动作,执行doTest()函数 -->
<a href="javascript:doTest();void(0);" rel="external nofollow" >here</a>
<!-- 或者直接使用href="" rel="external nofollow" rel="external nofollow" -->
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" onclick="doSomething();return false;">什么问题都解决了,包括浏览器不兼容问题</a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" onclick="alert();event.returnValue=false;">test</a>
点击链接后,提交表单:
<a href="javascript:void(document.form.submit())" rel="external nofollow" >单此处提交表单</a>
链接的几种办法:
-
window.open(''url'')
-
window.location.href="" rel="external nofollow" rel="external nofollow"
-
<script>
function openWin(tag,obj)
{
obj.target="_blank";
obj.href = "Web/Substation/Substation.aspx?stationno="+tag;
obj.click();
}
</script>
<a href="javascript:void(0)" rel="external nofollow" onclick="openWin(3,this)">株洲</a>
本文参考:opper