[thelist] [ASP] newbie resources

Luther, Ron Ron.Luther at hp.com
Fri Nov 15 10:55:06 CST 2002


Hi Benjer,

Okay.  There are a bunch of articles and discussions on
intermingling ASP and HTML.  The consensus view seems to be
that you should try to keep that to a minimum.  YMMV.  Test
a few of your pages and see if it makes a noticeable difference.

For example, *this*:
<%
Dim showSub
showSub = Trim(Request.QueryString("subMenu"))
If (showSub = "chinaHouseExpress") Then
  Response.Write "<div id='subHead'><img src='images/expressSub.gif'
width='157' height='20'>"
Else If (showSub = "setMenu") Then
%>

is usually considered 'preferred' to *this*:
<%
showSub = Trim(Request.QueryString("subMenu"))
If (showSub = "chinaHouseExpress") Then
  %>
<div id='subHead'><img src='images/expressSub.gif' width='157' height='20'>
<%
Else If (showSub = "setMenu") Then
%>


No problem. The syntax for using variables in ASP that 'flow-thru'
to your HTML is pretty simple - you append them to the string you
are outputting:

<%
Dim showSub
showSub = Trim(Request.QueryString("subMenu"))
If (showSub = "expressSub") Then
  Response.Write "<div id='subHead'><img src='images/" & showSub & ".gif'>"
%>

or, {including the _ to allow you to split a very long line across
mutliple shorter lines},

<%
  Response.Write "<div id='subHead'><img src='images/" & showSub & _
	".gif' width='157' height='20'>"
%>


HTH,


RonL.

-----Original Message-----
From: Benjer [mailto:futureweb at macmail.com]

this is someone in our office idea... I was unsure about opening and closing
the ASP tags - does this mean more visits to server/slower etc.

Response.Write"<div id='subHead'><img src='images/
insertVarNameHereSomeHow+
Sub.gif'></div>"




More information about the thelist mailing list