ASP Syntax Error (was: RE: [thelist] CSS Question - Simple)

Marc Seyon seyon at delime.com
Mon Sep 15 17:47:46 CDT 2003


Message from Alex Ezell (9/15/2003 04:43 PM)
>On Monday, September 15, 2003, 4:24:43 PM, Rob wrote:
>
> > Take a look at this:
>
> > Dim strings, doohickey
> > doohickey = 1
> > strings = "<h1>" & if doohickey = 1 then response.write("Hello") & "</h1>"
> > response.Write(strings)
>
> > I thought you could do this in ASP? What would be the alternative?
>
>I think it would be easier and more manageable code to do something
>like:
><%
>Dim strings, doohickey
>doohickey = 1
>
>If doohickey = 1 Then
>    strInsert = "Hello"
>End If
>%>
><h1><%=strInsert%></h1>
>
>IMO, that helps keep the HTML out of the ASP if you should want to
>change it at a later date. It also help seperate the IF statment from
>the display of its result. That will make troubleshooting easier as
>things get more complex.

Except that if doohickey is not equal to 1, you'll have an empty <h1></h1> 
in your code. I'd modify Alex's suggestion slightly to write the entire 
line of code only if doohickey = 1.

regards.
-marc

--
Carnival 2003 in all its photographic glory. Playyuhself.com
http://www.playyuhself.com/


More information about the thelist mailing list