用WebStorm调试本地html(含嵌入的javascript).
题外话:
以前很少能调试,甚至以为不能调试(好笨),后来我看了一本叫做<<Learning Three.js>>的一本书后,里面推荐有几种javascript的编辑工具,都蛮好的,在这里我用 WebStorm,最灵活的是"提示功能",真的很强,比我们在 Visual Studio不懂要强多少倍.可能很多人都应该会用很多强灵活的开发工具,这里我就说怎么调试单个 html文本的javascript:
Local debugging: starting a debugging session from an HTML file
- Set the breakpoints in the JavaScript code, as required.
- Open the HTML file with the JavaScript injection to debug or select the HTML file in the Project view.
- On the context menu of the editor or the selection, choose Debug <file name>. The automatically generated debug configuration starts a debugging session. This configuration is temporary but you can save it later.
The file opens in the default browser and the Debug tool window appears.
- If you are using Chrome or Dartium, you need a Chrome extension. If the extension is not installed and activated in your browser, the Debug tool window shows a message with a link to the web store where the extension is available. Click the link and install the extension. For details, see Using JetBrains Chrome Extension.
- In the Debug tool window, proceed as usual: step through the program, stop and resume program execution, examine it when suspended, view actual HTML DOM, edit the code, etc.
其他配置具体参见:https://www.jetbrains.com/webstorm/webhelp/debugging-javascript.html#d72861e521