try
if(!list[i]["url"]) { A.href = "javascript:;"; } else { A.href = list[i]["url"]; }
or
if(!list[i]["url"]) { A.href = "#";A.onclick="return false;" ;} else { A.href = list[i]["url"]; }
or
if(!list[i]["url"]) { A.href = "#";A.onclick=function(){return false;};} else { A.href = list[i]["url"]; }
if(!list[i]["url"]) { A.href = "javascript:;"; } else { A.href = list[i]["url"]; }
or
if(!list[i]["url"]) { A.href = "#";A.onclick="return false;" ;} else { A.href = list[i]["url"]; }
or
if(!list[i]["url"]) { A.href = "#";A.onclick=function(){return false;};} else { A.href = list[i]["url"]; }
var voidF = function () {
var e = window.event || arguments.callee.caller.arguments[0];
e.preventDefault && (e.preventDefault(), 1) || (e.returnValue = false);
};
</script>
<!--注意事件执行顺序href里的js,是在跳转/打开后,在新页执行的。它的域取决于target。-->
<a href="javascript:" target="_blank" onclick="voidF()">测试一下</a>
<a href="javascript:">测试一下</a>
<script type="text/javascript">
document.getElementById('a').removeAttribute('href');
</script>
当然会,一个有手一个没手
就是说,当没有href时,它就如同文本...