<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>javascript的parentNode父节点操作(1)</title>
<script>
window.onload = function(){
var oA = document.getElementsByTagName('a');
for(var i=0; i<oA.length; i++){
oA[i].onclick = function(){
this.parentNode.style.display = 'none';
}
}
}
</script>
</head>
<body>
<ul>
<li>111<a href="javascript:;">隐藏</a></li>
<li>222<a href="javascript:;">隐藏</a></li>
<li>333<a href="javascript:;">隐藏</a></li>
<li>444<a href="javascript:;">隐藏</a></li>
<li>555<a href="javascript:;">隐藏</a></li>
</ul>
</body>
</html>
javascript的parentNode父节点操作(1)
最新推荐文章于 2024-10-07 17:06:40 发布