<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="'div1" onclick="func1()">hello world
    <p class="ppp">hello p</p>
</div>
<script>
    var obj = document.getElementsByClassName("ppp")[0];
    obj.onclick = function(){
        alert(123);
    }
    function func1(){
        alert("func1");
    }
</script>
</body>
</html>

 

相关文章:

  • 2022-01-23
  • 2021-06-25
  • 2022-12-23
  • 2022-02-09
  • 2021-12-09
  • 2021-06-02
猜你喜欢
  • 2022-01-05
  • 2021-08-10
  • 2022-01-11
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案