window.onload=function(){
if (document.all){
alert(document.all);
window.document.onclick= new Function("return onClick(event);");
}else{
window.document.body.setAttribute("onclick","return onClick(event);")
}}
我想要的效果有了,可是页面上的所以连接都失效了。请问该如何改写这段js
if (document.all){
alert(document.all);
window.document.onclick= new Function("return onClick(event);");
}else{
window.document.body.setAttribute("onclick","return onClick(event);")
}}
我想要的效果有了,可是页面上的所以连接都失效了。请问该如何改写这段js
//...your code
if(event.srcElement.tagName=='a')return true;
//...your return
}
if (document.all){
alert(document.all);
window.document.onclick= new Function("if(event.srcElement.tagName=='A'){event.srcElement.click();}else{return onClick(event);}");//判断是否是超连接
}else{
window.document.body.setAttribute("onclick","return onClick(event);")
} }
else里会使a标签无效吗?没有试过, 如果发生也参照楼上代码加以修改就可以了