开发者

Help! How to get the event handler with IE Dom interfaces?

I am working to use IE Dom interface to automate IE page access. I am trying to get all event handlers defined in a page. I am using IHTMLElement object now for this purpose. If the html page defines "onclick=xxx", element.onclick returns the click handler. However, if an event handler is defined in javascript, element.onclick simply returns NULL. What's the right way to get the event handler then?

Thanks, xin

Below is an example that uses javascript to define event handler.

<!doctype html>
<html>
  <head>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript"> </script>
  </head>
  <body>
    <script>
      $(document).ready(function(){
        $("a").click(function(event){
          $(this).hide("slow");
          alert("Thanks for visiting!");
          window.location="http://cnn.com";
        });
      });
    </script>
    <a>jQuery</a>
  </body>
</ht开发者_高级运维ml>


This is not possible.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜