Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: All
Mar 29, 1999

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.

 
<%@ Language=VBScript %>
<HTML>
<BODY>
<%
For Each name In Request.ServerVariables 
  Response.Write name & "="  & _
    Request.ServerVariables(name) & "<br>" & vbCrLf
Next
%>
</BODY>
</HTML>
VBScript also provides the constant vbTab to insert a tab character. HTML browsers ignore vbTab just like they ignore vbCrLf.
Ken Cox
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date