开发者

Call a function in javascript on all onclick events

开发者 https://www.devze.com 2023-03-13 11:09 出处:网络
I want to call a function in javascript. I want to call this function on click of every events or at least on click of all the onclick events in the doc开发者_运维知识库ument.

I want to call a function in javascript. I want to call this function on click of every events or at least on click of all the onclick events in the doc开发者_运维知识库ument.

Please let me know how to do this.


<html>
    <head>
        <script type="text/javascript" language="JavaScript">
        <!--

        document.onclick = myClickHandler;


        function myClickHandler() {
          alert("The document was clicked!");
        }
        -->
        </script>
     </head>
     <body>
         click anywhere within this document.
         <a href="x.html">this will fire the handler too!</a>
     </body>
   </html>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号