Make ASP-Generated Code Easier to Read With VbCrLf

Make ASP-Generated Code Easier to Read With VbCrLf

Technically, neatness doesn’t count in the world of HTML source code. However, nicely formatted source code makes debugging easier and adds a professional touch to your work. That’s why HTML text editors usually generate very readable source code that includes line breaks and indentations.

You may have noticed that HTML code that is created on the fly using Active Server Pages (ASP) can look quite ragged. It can even come out as one long line of HTML when viewed in Notepad. To increase the readability of the source code, add line breaks to your server-side VBScript with the built-in string constant vbCrLf. In your ASP code, vbCrLf writes a carriage return and new line combination.

For example, the addition of vbCrLf in this code makes no difference to the HTML page as seen in the Web browser, but the line breaks make a world of difference to anyone who wants to read the HTML source that the ASP script created.

 " & vbCrLfNext%>

VBScript also provides the constant vbTab to insert a tab character. HTML browsers ignore vbTab just like they ignore vbCrLf.


Share the Post: