Visual Studio 2005 is shipped with a lot of new features for all developers. If you are windows, web or distributed application developer, you will be happy to the see the added new features in VS 2005.
This article is for web developers, because it's target is one of the new feature in VS 2005 which is debug client side script.
Applies on: Visual Studio 2005
Most of developers in VS 2003 use the traditional techniques to validate their java script code, like using alert message to show the current result if it's follow the validation required or not.
In VS 2005 has built in Java script Debugger, and what you need is just write your java script function and run the debugger by writing one line of code.
We will start by building simple web site which contains 3 input fields and a button to divide the values of 2 numbers and output it in a result field.
A screen shot of the page.
Once you write the 2 numbers and click divide button, it will call client side function to divide 2 numbers.
Screen shot of the HTML of the page.
<asp:label id="lblFirstNumber" runat="server" Width="125">
<input id="txtNumber1" type="text" maxLength="3"
<asp:label id="lblSecondNumber" runat="server" Width="125">
<input id="txtNumber2" type="text" maxLength="3"
<asp:Label id="lblResult" runat="server" Width="125">
<input id="txtResult" type="text" size="5" maxlength="5"
<td width="150" align="center">
<input id="btnDivide" onclick="return btnDivide_Clicked()"
type="submit" value=" Divide " name="btnDivide">
var intNumber1 = 0;
var intNumber2 = 0;
var intResult = 0;
intNumber1 = document.all('txtNumber1').value;
intNumber2 = document.all('txtNumber2').value;
intResult = intNumber1/intNumber2;
document.all('txtResult').value = intResult;
View the page in the browser, the script debugger will run.
Select the Script editor, as below figure shows:
Then the script editor opens and then you can work and validate the validation through adding your variables on the watch.
You can use F9 and F10 to go line by line for your code.
After return statement you will return to your page with the result.