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

  • 相关阅读:
    Git安装配置
    Openstack 错误日志查看方法
    keystone v3.0与2.0的区别
    Python远程调试Openstack
    openstack遇到的错误
    特别翔实的adaboost分类算法讲解 转的
    h5 html5 模拟时钟 页面
    js 面向对象 jquery 全局变量 封装
    HTML5 h5 微信 浮层 提示 点击右上角,从浏览器打开 pop.png
    jquery中ajax使用error调试错误的方法,实例分析了Ajax的使用方法与error函数调试错误的技巧
  • 原文地址:https://www.cnblogs.com/awpatp/p/1637071.html
Copyright © 2011-2022 走看看