Active Server - Your Comments Are Welcome


You've probably heard more than you ever wanted to know about the importance of commenting your code. However, we feel this point can't be stressed enough especially when it comes to ASP code. Consider, for a moment, the following JavaScript code:


  • this.parent.opener.search.sort.selectedIndex = index

Do you know what this code does? If not, don't worry. Neither did the author who needed 15 minutes opening 8 different files to determine which file was the parent and what was the purpose of the value being set. Whereas, a simple comment probably would have saved a lot of time. Following is the syntax for commenting JavaScript, VBScript, and HTML code:


  • //This is a javaScript comment
  • 'This is a VBSpcript comment
  • <!-- This is an HTML commnt -->

Commenting your code only takes a little extra time, but it could mean a big difference if you're looking at the code years later or passing it on to another programmer.

Go back