About JavaScript debugging

xiaoxiao2021-03-06  111

In the .NET (other environment, it is also possible), in addition to this soil method with Alert, JavaScript can also be debugged, and there are 2 methods:

A.

1. First, let your IE allow you to debug script, the specific steps are as follows: Open IE-> Tools Menu -> Inter Home -> Advanced Tab -> Remove the "Disable Script Debug" option 2, open vs.net, create a New ASP.NET project (or open one) 3, run the page you want to debug 4, when your page is rendered in IE, return to vs.net5, set breakpoints in the script: Debug menu -> Window -> Debug Document -> Select the page you want to debug in "Run Document" (this is a floating toolbar similar to the Solution Manager) 6, then you can enter the script by operating the web, when the script is running When breakpoint, you can debug it. If you want to enter the debug state when you start loading, you can press F10 (process) to debug.

B.

1, first, let your IE allow debugging scripts, the specific steps are as follows: Open IE-> Tools Menu -> Inter Home -> Advanced tab -> Remove the Disable Script Debugging option

2. Add a statement at the code you want to debug:

Debugger

The script is running to the Debugger.

The shortcoming of the A method is that the code when Load in JavaScript cannot debug, that is, the following code cannot be debugged: