p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   if and then without end ifs in Classic ASP (http://p2p.wrox.com/showthread.php?t=39404)

crmpicco March 6th, 2006 10:49 AM

if and then without end ifs in Classic ASP
 
Code:

    <%
    sURL = Request.ServerVariables("URL")

    if InStrB(sURL, "net1.asp") then response.Write "<img src=""images/rules.gif"" />"
    elseif InStrB(sURL, "cancel.asp") then response.Write "<img src=""images/rules.gif"" />"
    elseif InStrB(sURL, "net2.asp") then response.Write "<img src=""images/rules_grey.jpg"" />"
    elseif InStrB(sURL, "net3.asp") then response.Write "<img src=""images/rules_grey.jpg"" />"
    else response.Write "<img src=""images/rules.gif"" />"
    %>

Is there a quicker way of coding these lines? I just cant see it ATM.

Picco


www.crmpicco.co.uk

mat41 March 6th, 2006 07:13 PM

For my performance management systems that use a traffic light system. I print a color (image name) based the the score (assessment 0=green, 1=amber, 2=red) which is stored in the database. EG. My images are called:
assess0 = green
assess1 = amber
assess2 = red

There fore anywhere in the system where I need to show an assesment color is:
<img src="<%= URLBase %>images/assess<%= getAssess(1) %>.gif" width="34" height="17" alt="<%= getAssess(2) %>" border="0">

I find this method useful, it eliminates multiple if's and is a good time saver. I believe you caould use this process for your needs



Wind is your friend
Matt


All times are GMT -4. The time now is 08:19 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.