[thelist] [ASP] newbie resources

Scott Schrantz scotts at rci-nv.com
Fri Nov 15 11:51:00 CST 2002


> -----Original Message-----
> From: Benjer [mailto:futureweb at macmail.com]
>
> [CODE]
> <%
> Dim showSub
> 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
> %>
>   <div id="subHead"><img src="images/setMenu Sub.gif" width="157"
> height="20"></div>
> <%
> Else If (showSub = "starters") Then
> %>
>   <div id="subHead"><img src="images/salads Sub.gif" width="157"
> height="20"></div>
> <%
> End If
> %>
> [/CODE]

You've basically got the right idea there. It works, but in a case like
that, Select Case would cut out the redundancy.

<%
showSub = Trim(Request.QueryString("subMenu"))
Select showSub
	Case "chinaHouseExpress"
		showImg = "expressSub.gif"
	Case "setMenu"
		showImg = "setMenuSub.gif"
	Case "starters"
		showImg = "saladsSub.gif"
End Select
%>
<div id="subHead">
<img src="images/<%= showImg %>" width="157" height="20" />
</div>

> 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.

There's still only one visit to the server, but there is a processing hit
from having multiple code blocks. On a small site, it shouldn't matter, and
I have pages with three or four code blocks scattered through them. It might
make a difference of a few fractions of a second...nothing to worry about.

The Wrox book you have is one of the only ASP books I ever bought, along
with Wrox's ASP Databases. Those books cover just about everything. There
are more examples at:
http://www.w3schools.com/asp/default.asp
http://www.4guysfromrolla.com/
http://www.coveryourasp.com/

--
Scott Schrantz
work: www.rci-nv.com
play: www.computer-vet.com



More information about the thelist mailing list