Welcome to WebmasterWorld Guest from 54.144.126.195

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

Passing Values or Content using Params

Using Javascript

     

isaaclloyd

6:06 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



Here is the script:


<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function getParams() {
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx!= -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
params = getParams();
// End -->
</script>

Heres the address it uses when the form is submitted:


[example.com...] etc....

Heres the Problem:


<SCRIPT LANGUAGE="JavaScript">
name = unescape(params["name"]);
address = unescape(params["address"]);
</SCRIPT>

SCRIPT OUTPUT:
Name = new+guy
Address = 1002+road

I need the output to be:


OUTPUT:
Name = new guy
Address = 1002 road

so it needs to change the "+" for a "space". Any help or comments is greatly apreciated.

~Isaac Lloyd~

txbakers

7:02 pm on Mar 21, 2005 (gmt 0)

WebmasterWorld Senior Member txbakers is a WebmasterWorld Top Contributor of All Time 10+ Year Member



take out the "unescape" from the processing script.

isaaclloyd

2:50 am on Mar 22, 2005 (gmt 0)

10+ Year Member



Actually heres what I found to work:


name = unescape(params["name"]);
var regEx = /\+/gi;
name = name.replace(regEx," ");

Thanks,

~Isaac Lloyd~

 

Featured Threads

Hot Threads This Week

Hot Threads This Month