您已经有了所需的内容,但语法进行了少量更改:
<a href="www.mysite.com" onclick="return theFunction();">Item</a><script type="text/javascript"> function theFunction () { // return true or false, depending on whether you want to allow the `href` property to follow through or not }</script><a>标签
onclick和
href属性的默认行为是执行
onclick,然后按照进行
href操作,直到
onclick不返回就
false取消该事件(或未阻止该事件)



