javascript控制台_IE中的Javascript控制台

javascript控制台_IE中的Javascript控制台

javascript控制台

I'm a sucker for consoles. The ability to quickly type some code and see it executed right then and there... priceless. That's why I'm a huge fan of Firebug's JavaScript console. But what about IE?

我是游戏机的傻瓜。 快速键入某些代码并立即看到代码执行的能力……无价之宝。 这就是为什么我非常喜欢FirebugJavaScript控制台的原因。 但是IE呢?

选项1-Firebug Lite (option 1 - Firebug lite)

Firebug lite is a lighter version of the proper Firebug which runs in browsers other than Firefox. You "install" the bookmarklet and voila - JavaScript console and other goodies are available on any page.

Firebug lite是正常Firebug的较轻版本,可在除Firefox之外的浏览器中运行。 您可以“安装”小书签和内容-在任何页面上都可以使用JavaScript控制台和其他工具。

javascript控制台_IE中的Javascript控制台

You visit any page and click the "Firebug lite" bookmarklet...

您访问任何页面,然后单击“ Firebug lite”书签...

javascript控制台_IE中的Javascript控制台

... then you hack away in the shiny console!

...然后您就可以在闪亮的控制台中乱砍!

选项2-内置MS脚本编辑器/调试器 (option 2 - built-in MS script editor/debugger)

If you do any javascript in IE, it's a good idea to have this debugger guy enabled. There's actually at least three different debuggers, but one of them is already installed without you lifting a finger. If you enable it, you can debug any time there's a JavaScript error on the page. It also features a console! You can't get to the console unless there's a JS error, so you may need to cause the error yourself. Here's the step-by-step scenario.

如果您在IE中使用任何JavaScript,则最好启用此调试器。 实际上至少有三个不同的调试器,但是其中一个已经安装好了,无需您费力。 如果启用它,则可以随时在页面上出现JavaScript错误时进行调试。 它还具有一个控制台! 除非出现JS错误,否则您将无法进入控制台,因此您可能需要自己引起该错误。 这是逐步的方案。

javascript控制台_IE中的Javascript控制台

Go to menu Tools / Internet Options... / Advanced tab. Under the "Browsing" category uncheck the box that says "Disable Script Debugging"

转到菜单工具/ Internet选项... /高级选项卡。 在“浏览”类别下,取消选中“禁用脚本调试”框

javascript控制台_IE中的Javascript控制台

Go to any page and cause an error, by typing in the address bar some non-existing property or some non-existing object for example. Like javascript:alert(a.a.a)

例如,通过在地址栏中键入一些不存在的属性或某些不存在的对象,可以转到任何页面并导致错误。 像javascript:alert(aaa)

javascript控制台_IE中的Javascript控制台

Non-surprisingly, you get an error, but now you have the option of debugging the error:

毫不奇怪,您会收到一个错误,但是现在您可以选择调试错误了:

javascript控制台_IE中的Javascript控制台

You're given a list of debuggers, in case you've installed more debuggers from MS. Select your debugger or just hit Yes:

如果已从MS安装了更多调试器,则将为您提供调试器列表。 选择调试器或单击是:

javascript控制台_IE中的Javascript控制台

Just say OK here...

在这里说好...

javascript控制台_IE中的Javascript控制台

Click "Break"...

点击“中断” ...

javascript控制台_IE中的Javascript控制台

Finally - a console! We're in! The console is the so-called "Immediate" window, which is not displayed by default. To see it go to menu Debug / Windows / Immediate. Then just start fiddling with the page. Type anything and hit enter to see it evaluated. You also list the properties of an object by typing its name, like document.images[0] or just document.

最后-控制台! 我们进来了! 控制台是所谓的“立即”窗口,默认情况下不会显示。 要查看它,请进入菜单Debug / Windows / Instant。 然后,开始摆弄页面。 输入任何内容,然后按Enter键以查看其评估结果。 您还可以通过键入对象的名称来列出对象的属性,例如document.images[0]或只是document

javascript控制台_IE中的Javascript控制台

Once you've had your fun, stop debugging:

玩得开心之后,请停止调试:

javascript控制台_IE中的Javascript控制台

Enjoy the results of your hard work, a.k.a. replacing some logo with a shot of your favorite book ????

享受辛勤工作的结果,也可以用自己喜欢的书的镜头替换一些徽标????

Tell your friends about this post on Facebook and Twitter

FacebookTwitter上告诉您的朋友有关此帖子的信息

翻译自: https://www.phpied.com/javascript-console-in-ie/

javascript控制台