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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File with space in its name does not open

Status
Not open for further replies.

kav123

Programmer
Joined
Jan 12, 2005
Messages
210
Location
GB
I am opening a popup window using a javascript function. The popup is called from an asp page, thru a link i.e. when you click on a link a pop up opens. The file path is passed as a parameter from the asp file to the javascript function. However, this does not work when there is a space in the file name or even in the path(i.e. the folder name). The path to the image file is correct though. I have used Server.URLEncode, unescape functions but to no avail.

Ideas anyone, thanks.
 
Sorry folks, sorted it. Sounds silly now that i have solved it, thought i would share it with you guys, i used escape() function in the javascript function, where the path is used to open the file. i.e.)escape(imageURL)
 
Code:
<script type="text/javascript"> 
document.write(encodeURI("this is a test.jpg"));
</script>

You also have the decodeURI for decoding, but I believe you only need the encodeURI for this purpose.

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top