PDA

View Full Version : Syntax Nightmare!


christrinder
12-12-2002, 04:45 PM
Can somebody please help me sort out the syntax for this button. There's too many "'s and ''s inside each other... my brain's like some sort of colon orgy! Any ideas?

<p><input type="button" class="button" value="our stats" OnClick='parent.location="inputprofile.asp?dealership='<% Response.Write Session("ct0001dealership") %>'";'> - view the stats for <% Response.Write Session("ct0001dealership") %></p>

christrinder
12-12-2002, 04:48 PM
Don't worry, I gave up and called a JS function instead. Out of interest though, is there a way I could have put it all in the one line?

Cheers,

Chris

Roy Sinclair
12-12-2002, 07:18 PM
This should work:

<p><input type="button" class="button" value="our stats" OnClick="parent.location='inputprofile.asp?dealership=<%=Session("ct0001dealership")%>';return false;"> - view the stats for <%=Session("ct0001dealership")%></p>

"=" is a great shorthand for response.write and helps reduce the visual complexity of the code. Just remember that the " marks inside the <% %> tags aren't seen by the html code so they don't apply there.