This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > March 2004 > OT: JavaScript for encoding special characters





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author OT: JavaScript for encoding special characters
Kindler Chase

2004-03-12, 3:28 am

I need to encode the backslash in a JavaScript generated URL and have found
that the JavaScript function 'escape' will not encode these characters:
* @ - _ + . /

I need to encode the backslash, i.e., %2F - and this is what I've come up
with:

function n3_backSlash(url){
url = url.replace(/[/]/g,'%2F') // Everything in sq. bracket will be
replaced with a %2F
return url;
}

Though this appears to work fine, I'm not sure if I've set up the RegEx
properly. Is this correct? or is there another way to encode the backslash?

--

kindler chase
http://www.ncubed.com
Home of SuperInvoice: The Online Invoicing Application.
Organize your billing process and impress your clients.

news://news.ncubed.com/support
n3 Support Group


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews