Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with &'s and server.urlencode

Status
Not open for further replies.

Jeremy21b

Technical User
Jul 7, 2002
127
CA
I have a page that opens up in a new window with a javascript window.open function. The page needs to pass a string value to this window. Whenever there is a '&' in the string the remainder of the string is dropped by the new window. So if it passed say 'peanut buter & jam' the window would only see 'peanut butter'. I used a server.urlencode on the 1st page which is supposed to convert the '&' to & I believe. It doesn't seem to be properly doing the server.urlencode. Perhaps it is because it is within a javascript function call. Anyone know how I can get around this? Thanks.
 
You should use escape function from JavaScript
Code:
-- a.html --
<script language=javascript>
window.open("b.html?"+escape("Jam & Bam"),"","");
</script>

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Or Server.HTMLEncode from ASP.

Server.URLEncode does URL encoding (RFC 1738).
 
Thanks. That escape function appears to work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top