Quote Help

S

scott

I'm trying to get my double quotes correct in LISTING 1. Can someone correct
the quotes surrounding the sURL variable. Also, I'd appreciate it all of the
quotes were double quotes instead of single quotes. LISTING 2 just shows the
code working with a hard-coded url. Thanks for any help.


LISTING 1: (causes js unterminated string)

'Response.Write ("<input type=button value=""Continue&nbsp;&gt;&gt;""
onclick='javascript:document.location=" & sURL & ";""'></td></tr></table>")



LISTING 2: (Works)
Response.Write ("<input type=button value=""Continue&nbsp;&gt;&gt;""
onclick=""javascript:document.location='calendar_admin.asp';""'></td></tr></table>")
 
A

Aaron Bertrand [SQL Server MVP]

'Response.Write ("<input type=button value=""Continue&nbsp;&gt;&gt;""
onclick='javascript:document.location=" & sURL &
";""'></td></tr></table>")

Response.Write "<input type=button value='Continue &gt;&gt;'
onclick='javascript:location.href=""" & sURL & """;'></td></tr></table>"

Or to make it easier to follow,

sURL = """" & sURL & """"

Response.Write "<input type=button value='Continue &gt;&gt;'
onclick='javascript:location.href=" & sURL & ";'></td></tr></table>"

Or just call a function in the onclick handler and dump the URL into the
function.

Response.Write "<input type=button value='Continue &gt;&gt;'
onclick='go();'></td></tr></table>"
%>
<script>
function go()
{
location.href="<%=sURL%>";
}
</script>

A
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top