zoukankan      html  css  js  c++  java
  • Debug IE中的JavaScript

    默认的script debugging是被关闭的, 要开启需要:

    Tools->Internet Options…->Advanced->Disable Script Debugging

    在XP SP2上, 选项被拆分成了两项:

    Tools->Internet Options…->Advanced->Disable Script Debugging (Internet Explorer)
    Tools->Internet Options…->Advanced->Disable Script Debugging (Other)

    当你开启了Script Debugging之后, 菜单项‘View->Script Debugger’会变的可见, 使用它你就可以断入debugger中了.

    一般使用的debugger有三种, 第一个是Visual Studio, 第二个是Microsoft Script Debugger, 第三个是Microsoft Script Editor.

    简单说一下Visual Studio中的script debugging.

    第一种方法: 比如说有一个包含JavaScript的html的页面.

    • Enable script debugging in IE (see image: Tools -> Internet Options -> Advanced)
    • Open the html file in Visual Studio
    • Set a breakpoint and hit F5 / Start Debugging or hit F10 / F11 to single step

    剩下的就跟在debugging一个普通程序一样了.

    第二种方法: 如果应用程序不可能通过在visual Studio中点击F5来启动, 比如说开始debug之前脚本还在服务器上, 那么就需要用第二种方式了.

    • Open the web site in Visual Studio and open the .js file for editing
    • Set a breakpoint at a suitable place in the .js file (eg in the this.initialize function)
    • In Visual Studio go to Debug -> Attach to Process
    • Ensure that either Automatic or Script is selected as the type of code to debug (see images below)
    • Select the relevant IE process from the available process and click "Attach" (see image below)
    • Return to IE and load up the gadet (or reload it) and the breakpoint should fire and you'll drop back into Visual Studio as before

    唯一不爽的地方就是你需要经常在"Attach to Process"对话框中进进出出. 相比起Visual Studio的强大功能来说, 这个缺点也算不得什么.

    如果你希望在Visual Studio中新开一个浏览器, 你可以在solution Explorer中选择一个页面, 右键单击, 选择"Browse With". 这里你还能更改默认的浏览器.

    原文:

    Script Debugging with Visual Studio

    http://blogs.msdn.com/mikeormond/archive/2006/01/13/512496.aspx

  • 相关阅读:
    pandas读写csv最简代码
    csv.read和csv.write
    交叉验证
    纪念被win10大更新搞崩的vbox
    c++中关于保留小数的小总结
    Java里的值传递与“引用传递”——一些想法
    Eclipse使用遇到的一些问题及解决方案(持续更新)
    Pray for 京阿尼——愿逝者安息,伤者早日康复
    洛谷p1208—混合牛奶【典型贪心】(关联排序小技巧)
    洛谷p1217—回文质数(默默宣传打表法)
  • 原文地址:https://www.cnblogs.com/awpatp/p/1637071.html
Copyright © 2011-2022 走看看