<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script type="text/javascript">
        window.onload = function () {
            //取出所有的a标签
            var oUl = document.getElementById("ul1");
            var aA = oUl.getElementsByTagName("a");
            for (var i = 0; i < aA.length; i++) {
                //给每个a标签注册事件
                aA[i].onclick = function () {
                    //this是当前元素,parentNode  是单数,因为每个节点,只有一个父节点!有多个子节点
                   this.parentNode.style.display = "none";
                }
            }
        }
    </script>
</head>
<body>
    -----------点击“隐藏” 隐藏每行中的文字-----------
    <ul >
        <li>电风扇发<a href="javascript:void(0)">隐藏</a></li>
        <li>电松岛枫扇发<a href="javascript:void(0)">隐藏</a></li>
        <li>大幅度<a href="javascript:void(0)">隐藏</a></li>
        <li>合格后<a href="javascript:void(0)">隐藏</a></li>
        <li>的发的发的我<a href="javascript:void(0)">隐藏</a></li>
    </ul>
</body>
</html>

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-21
  • 2021-10-16
  • 2022-02-20
  • 2021-09-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
相关资源
相似解决方案