1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help with ASP and response.write

Discussion in 'C#' started by StealthRT, Mar 17, 2006.

  1. #1
    I need help trying to get the following code correctly syntaxes:
    
    <%
    
    Response.write "<td><div align=""center""><input name=Icecream type=submit value=""Get This"" onclick="session(""IsPrize"") = ""YES"";document.getElementById('txtTemp').value='Hash.Browns';document.getElementById('txtTemp2').value='100';SetDis();></div></td>" & vbcrlf
    
    %>
    
    Code (markup):
    And i have also tryed the following code:
    
    <%
    
    Response.write "<td><div align=""center""><input name=Icecream type=submit value=""Get This"" onclick=session(""IsPrize"") = ""YES""""; document.getElementById('txtTemp').value='Cole.Slaw';document.getElementById('txtTemp2').value='100';SetDis();></div></td>" & vbcrlf
    
    %>
    
    Code (markup):
    For some reason the error accurse at the session call for the frist one and it has no errors until i click the button on the second code. I’m sure I do not have the syntax correct so if someone could lend a hand then that would be great. I can not seem to get the session("isPrize") = "YES" working.

    thanks,
    David
     
    StealthRT, Mar 17, 2006 IP
  2. jaymcc

    jaymcc Peon

    Messages:
    139
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi, try this...

    
    <%
    
    Response.write "<td><div align=""center""><input name=Icecream type=submit value=""Get This"" onclick="session(""IsPrize"") = ""YES"";document.getElementById('txtTemp').value='Hash.Browns';document.getElementById('txtTemp2').value='100';SetDis();"></div></td>" & vbcrlf
    
    %>
    
    Code (markup):
    I think you're only missing one "

    Jay
     
    jaymcc, Mar 18, 2006 IP
  3. iShopHQ

    iShopHQ Peon

    Messages:
    644
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #3
    
    response.write("<td>")
    response.write("<div align=""center"">")
    response.write("<input name=Icecream type=submit value=""Get This"" onclick="""&session("IsPrize") = "YES"""&";document.getElementById('txtTemp').value='Hash.Browns';document.getElementById('txtTemp2').value='100';SetDis();"">")
    response.write("</div>")
    response.write("</td>")
    
    Code (markup):
     
    iShopHQ, Mar 19, 2006 IP
  4. alstefani

    alstefani Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Why do you need all the response .write? I usually use clean html and where really necessary asp or vb.
     
    alstefani, Apr 6, 2006 IP
  5. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i have to agree with alstefani, i usually escape my script to pure html for multiple lines of code. however, if you're going to do it through response writes, i'd follow ishophq's example, with one minor modification.

    
    response.write("<td>") & vbcrlf
    response.write("<div align=""center"">") & vbcrlf
    response.write("<input name=Icecream type=submit value=""Get This"" onclick="""&session("IsPrize") = "YES"""&";document.getElementById('txtTemp').value='Hash.Browns';document.getElementById('txtTemp2').value='100';SetDis();"">") & vbcrlf
    response.write("</div>") & vbcrlf
    response.write("</td>") & vbcrlf
    
    Code (markup):
    adding the "& vbcrlf" (Visual basic line feed) at the end of each of your response writes will create much cleaner parsed code - and make it MUCH easier to debug.
     
    vectorgraphx, Apr 7, 2006 IP