开发者

Can you see JavaScript methods in a IE's debugger watch window?

开发者 https://www.devze.com 2023-02-22 10:52 出处:网络
Is it possible to see defined methods in the IE developer toolbar\'s watch window? e.g. if I defined a function called hello as a global, could I find it by looking around the DOM?

Is it possible to see defined methods in the IE developer toolbar's watch window?

e.g.

if I defined a function called hello as a global, could I find it by looking around the DOM?

function hello() {
    alert("hello");
}

If so, where about's in the watch window woul开发者_如何学Pythond I find them? If I "watch" the window object and then navigate to "methods" all I can see are the built-in methods not my new function hello().


EDIT:

The reason I ask, is that I have a number of deeply nested framesets*, which I need to access the JS methods from/to the levels in the hierarchy. So I don't have to manually hunt around trying to find which level in the hierarchy I need, I was hoping to be able to "browse it".

My question above is more of a general question, as I'm interested if you can browse methods using debugging tools (in fact, it doesn't really need to be IE developer toolbar - but in my context it would help).

*I thought I'd better mention my view on framesets, before I spark an off topic thread. I won't go into any further detail about the framesets here - it's ugly I know - but it's legacy code and I don't have a choice :-(


I can suggest you to use Chrome (with pre-installed Developer Tools) or Firefox with Firebug. Those tools are way better than IE Developer Toolbar. I'm sure they can fullfill your needs.

If you really can't live without IE Developer Tools, assuming you've got at least IE8, you can try to add a watch for "hello".


In IE developer toolbar you cannot. However with IE 8's Developer tools you can. Just make sure you choose the right html or JS file that you have put ur new function in. Use the call stack to see where your methods have been called.

Edit : IEInspector made DomInspector (DI) not IE Developer Toolbar.


While I don't know for SURE if this is the answer to your question, if you mean you wish to see the javascript associated with a page, you CAN do that using the developer tools.

Hit F12 in IE to open the window for the tools.

Now, choose the Script tab (button).

On that tab, you will see a drop down listing each of the linked javascript files. For instance, on the www.google.com home page with basically nothing displayed, I see 4 files (dropdowns) plus one that says: Others which has "about:none" on it.

IE8 used in my example.

There IS one other possibility on seeing MORE stuff that I find useful. http://ajax.dynatrace.com/ajax/en/

To give credit for MY source on this.

Here is John Resig's blog on this alternative: http://ejohn.org/blog/deep-tracing-of-internet-explorer/

0

精彩评论

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