Another option is to escape the code and write the html.
Generally you don't want to leave and re-enter ASP sections very often because it will slow down processing of the page. Here are two examples:
Code:
<%
'who knows where this x and y came from, I made em up :)
If x > y Then
%> <!-- We are now outside the asp script -->
<html>
<head>
<title>Page 1!</title>
</head>
<body>
<h1>Welcome to Page 1!</h1>
</body>
</html>
<% 'everything after this is back inside the ASP script
Else
%> <!-- Leaving the ASP swcript again -->
<html>
<head>
<title>Page 2!</title>
</head>
<body>
<h1>Welcome to Page 2!</h1>
</body>
</html>
<% 'going back into ASP script
End If
%>
Ok that was escaping the script to write html tags, now lets write it using Response.Write:
If x < y Then
Response.Write "<html><head><title>This is Page 1!</title></head><body>"
Response.Write "<h1>Welcome to Page 1!</h1>"
Response.Write "</body></html>"
Else
Response.Write "<html><head><title>This is Page 2!</title></head><body>"
Response.Write "<h1>Welcome to Page 2!</h1>"
Response.Write "</body></html>"
End If
Now if you decide to go the route of using Response.Write than you probably shouldn't put your asp tags on every line, because this will still cause it to go in and out of the asp processing mode which you were trying to avoid.
Another popular method (ok, I do it, who knows if anyone else does

)
is to include repeating things inside a function call or include file. Like in our example above I was repeating the top part quite a bit, so to keep the code looking clean lets define a header and footer function. The other advantage of this is that if I ever want to change them I only have to change them in one place and it will always be consistent.
Code:
If x < y Then
ShowHeader
Response.Write "<h1>Welcome to Page 1!</h1>"
ShowFooter
Else
ShowHeader
Response.Write "<h1>Welcome to Page 2!</h1>"
ShowFooter
End If
Function ShowHeader
Response.Write "<html><head><title>Welcome to my site</title></head><body>"
End Function
Function ShowFooter
Response.Write "</body></html>"
End Function
Obviously I probably have to little to need a header and footer function, but if you have a nice complicated layout that you want on every page then you could simply put it in functions and put those ni an include file. Then on every page you could include the file and call the ShowHeader and ShowFooter functions at the top and bottom.
Ok, i got caried away, sorry
-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924