jsp如何让a标签失效

JavaScript017

jsp如何让a标签失效,第1张

通过jquery的removeAttr实现的方法:

"<a href=“www.baidu.com” id=“baidu”>百度</a>"

js方法:

$("#baidu").removeAttr("href")

如此即可是a标签失效。

<!doctype html>

<html>

<head>

<title>无标题文档</title>

</head>

<body>

<script>

function wait5sec(){

document.getElementById("w1").setAttribute("href","http://www.baidu.com")

}

</script>

<a id="w1" href="javascript:void(0)" onClick="setTimeout(wait5sec,5000)">点我5秒后,链接生效</a>

</body>

</html>

另存为html;以上,希望能帮到你。