narrator Posted March 23, 2011 Share Posted March 23, 2011 Hi,I'd like to choose between 2 blocks of html, depending on what the variable equals. <if myvar="yes" then>a block of html <else>a different block of html<end if>I've tried coding it a few ways, each time coming up with a syntax error.Your help would be much appreciated :)Thank you Link to comment Share on other sites More sharing options...
justsomeguy Posted March 23, 2011 Share Posted March 23, 2011 What version of ASP are you using, and what language are you using to write the code? Link to comment Share on other sites More sharing options...
narrator Posted March 24, 2011 Author Share Posted March 24, 2011 What version of ASP are you using, and what language are you using to write the code?From the hosting, it only says asp, asp.net 1.1 and asp.net 2, on IIS 6.0.I could email them and ask for more details if that helps.I'm writing my site in asp and html, with a separate style page. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 24, 2011 Share Posted March 24, 2011 Well, if you're using VBScript with ASP classic, or VB.net, here are several examples of control structures:http://www.w3schools.com/VBScript/vbscript_conditionals.aspIf you're using C# with ASP.net, there are examples here:http://msdn.microsoft.com/en-us/library/50...h(v=vs.71).aspxIf you're not sure, the first step is to figure out which language you want to use. Link to comment Share on other sites More sharing options...
narrator Posted March 24, 2011 Author Share Posted March 24, 2011 Well, if you're using VBScript with ASP classic, or VB.net, here are several examples of control structures:http://www.w3schools.com/VBScript/vbscript_conditionals.asp..........If you're not sure, the first step is to figure out which language you want to use.Thanks just,I looked at that page and experimented a little. What I had trouble with was using the "document.write" part to place dozen or more lines of html.Ideally, I'd like to use "include" statements to put in some default content for both parts of the "if" (unless there's another way achieve this).Cheers Link to comment Share on other sites More sharing options...
narrator Posted March 24, 2011 Author Share Posted March 24, 2011 Worked it out. Quite simple really.I learned asp about 8 or 9 years ago... just remembering it now.<%Dim myNummyNum = 6If myNum = 6 Then%><B>hello</B><%Else%><B>not hello</B><%End If%>Cheers Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.