HTML to ASP

T

Troy Jerkins

Hi all,

I've been struggling for hours with this one and could really use some help
converting the code.
The HTML portion below works exactly the way I want it to:

<a language="vbs"
href=vbscript:window.open("http://web/SQL/update.asp?name=somename","newwin"
,"height=450,width=500") >Update</a>

I need to use this in a portion of ASP using the <% %> tags like:

with response
..write "blah"
..write "<a language=vbs
href=vbscript:window.open(http://web/SQL/update.asp?action=update&name=" &
Server.URLEncode(sName) & "&key=" & sKey & ",newwin,height=450,width=500)>"
..write("Update") & "</a>"
..write "blah"

end with

This always generates a warning in IE stating "Problems with this web page
may prevent it from displaying or functioning properly.....". Then a
reference to the script.

Line: 1
CHAR: 17
Error: Expected ')'
Code: 0
URL: <URL containing the script>

I've tried different combo's of quotes and syntax. I've even shaved the <A>
tag down to a simple URL only.
ex - .write "<a language=vbs href=vbscript:window.open("http://www.go.com")
No dice.
.write("Update") & "</a>"

The only thing that I can get to work is

..write "<a language=vbs href=vbscript:window.open()>"
.write("Update") & "</a>"

which opens up a blank window.

Regards,

--Troy
 
R

Ray at

Your problem is with the javascript syntax then, not ASP. Or vbscript,
rather. Try:

with response
..write "<a
href=vbscript:window.open(""http://web/SQL/update.asp?action=update&name=" &
Server.URLEncode(sName) & "&key=" & sKey &
""",newwin,height=450,width=500)>"
..write("Update") & "</a>"

end with

I'm not sure that I have that right, but basically, you have to have your
url enclosed in ' or " in the resultant response.

Ray at work
 
T

Troy Jerkins

Thanks Ray!!! at work.

That partially did the trick. I had to Encode my second variable to get it
to work. Otherwise, I received an "Unterminated String error". Although I'm
not sure why.
Also, I had to surround the other parameters with double quotes
""newwin"",""height=450,width=500""
Now it's working as expected.
Thanks again!! That saves me a few more hours of aggrevation.

-Troy
 
R

Ray at

Send me a dollar. ;P

Ray at work

Troy Jerkins said:
Thanks Ray!!! at work.

That partially did the trick. I had to Encode my second variable to get it
to work. Otherwise, I received an "Unterminated String error". Although I'm
not sure why.
Also, I had to surround the other parameters with double quotes
""newwin"",""height=450,width=500""
Now it's working as expected.
Thanks again!! That saves me a few more hours of aggrevation.

-Troy

href=vbscript:window.open(""http://web/SQL/update.asp?action=update&name="
href=vbscript:window.open("http://web/SQL/update.asp?name=somename","newwin" href=vbscript:window.open(http://web/SQL/update.asp?action=update&name="
 
V

VK

while u are at it may i suggest that using "with" for response.write might
seem like a good coding practice but could cause bad performance .
 

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,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top