你能在 IE 的调试器监视窗口中看到 JavaScript 方法吗?
是否可以在 IE 开发人员工具栏的监视窗口中看到定义的方法?
例如,
如果我将一个名为 hello 的函数定义为全局函数,我可以通过查看 DOM 来找到它吗?
function hello() {
alert("hello");
}
如果是这样,我可以在监视窗口的什么位置找到它们?如果我“观察”窗口对象,然后导航到“方法”,我所能看到的只是内置方法,而不是我的新函数 hello()。
编辑:
我问的原因是,我有许多深度嵌套的框架集*,我需要它们从层次结构中的级别访问/到层次结构中的级别访问 JS 方法。因此,我不必手动寻找我需要的层次结构中的哪个级别,我希望能够“浏览它”。
我上面的问题更多的是一个一般性问题,因为我感兴趣的是您是否可以使用调试工具浏览方法(事实上,它并不需要是 IE 开发人员工具栏 - 但在我的上下文中它会有所帮助)。
*我想在引发题外话之前我最好先谈谈我对框架集的看法。我不会在这里详细介绍框架集 - 我知道它很难看 - 但它是遗留代码,我别无选择:-(
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 would 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 :-(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议您使用 Chrome(预装了 开发者工具)或带有Firebug的Firefox 。这些工具比 IE 开发工具栏好得多。我相信他们能够满足您的需求。
如果你确实离不开 IE 开发工具,假设你至少有 IE8,你可以尝试添加一个“hello”监视。
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".
在 IE 开发者工具栏中 你不能。不过,使用 IE 8 的开发者工具就可以做到。只需确保您选择了正确的 html 或 JS 文件来放入您的新函数。使用调用堆栈查看您的方法被调用的位置。
编辑:IEInspector 制作了 DomInspector (DI),而不是 IE 开发工具栏。
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.
虽然我不确定这是否是您问题的答案,但如果您希望查看与页面关联的 JavaScript,则可以使用开发人员工具来实现。
在 IE 中按 F12 打开工具窗口。
现在,选择“脚本”选项卡(按钮)。
在该选项卡上,您将看到一个下拉列表,列出了每个链接的 javascript 文件。例如,在基本没有显示任何内容的 www.google.com 主页上,我看到 4 个文件(下拉菜单),外加一个文件显示:其他文件上有“about:none”。
我的例子中使用的是IE8。
还有另一种可能性是看到更多我认为有用的东西。 http://ajax.dynatrace.com/ajax/en/
注明我的来源关于这一点。
以下是 John Resig 关于此替代方案的博客:http://ejohn.org/blog /internet-explorer 的深度跟踪/
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/