p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_components thread: IF/Then Statements help


Message #1 by music_survey@h... on Thu, 14 Mar 2002 04:44:28
Hey guys! I've got a question here.. Still new to ASP I am trying to 

display some HTML when a condition is met. Here is what I have



<%

Dim strDistance



strDistance = Request("distance")



%>

<%

distance="&strDistance&"



%>



'Here is what I want to do



<%

If strDistance < 6000 Then

'If the conditon is met, I want certain HTML displayed and this is where 

I seem to be gettin stuck. I've tried to use Response.Write amongst some 

other things but nothing seems to work. I'm sure you guys have all done 

this before but I'm stuck.. Any help would be great.



End If

%>

Cheers,



Jon
Message #2 by Naresh Bobade <nareshbobade@y...> on Wed, 13 Mar 2002 22:19:15 -0800 (PST)
Hi jon,



It's really simple... let's take the same example as

yours -



<%

    Dim strDistance

    strDistance = Request("distance")

    If strDistance < 6000 Then

%>

     <!-- Your html msg comes here-->

     <center>

        <h1>I have a long to go in learning asp</h1>

     </center>

 

<%       

    End If

%>



Alternatively using response.write -



<%

    Dim strDistance

    strDistance = Request("distance")

    If strDistance < 6000 Then



      Response.write "<center><h1>I have a long to go

in learning asp</h1></center>"

    End If

%>





You can try both of the above stated solutions in ur

code.... and happy learning.



Cheers,

Naresh

--- music_survey@h... wrote:

> Hey guys! I've got a question here.. Still new to

> ASP I am trying to 

> display some HTML when a condition is met. Here is

> what I have

> 

> <%

> Dim strDistance

> 

> strDistance = Request("distance")

> 

> %>

> <%

> distance="&strDistance&"

> 

> %>

> 

> 'Here is what I want to do

> 

> <%

> If strDistance < 6000 Then

> 'If the conditon is met, I want certain HTML

> displayed and this is where 

> I seem to be gettin stuck. I've tried to use

> Response.Write amongst some 

> other things but nothing seems to work. I'm sure you

> guys have all done 

> this before but I'm stuck.. Any help would be great.

> 

> End If

> %>

> Cheers,

> 

> Jon

>  



> nareshbobade@y...


> $subst('Email.Unsub')

> 





$subst('Email.Unsub').





__________________________________________________

Do You Yahoo!?

Yahoo! Sports - live college hoops coverage

http://sports.yahoo.com/


  Return to Index