homepage Welcome to WebmasterWorld Guest from 54.163.89.8
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
Passing Values or Content using Params
Using Javascript
isaaclloyd

5+ Year Member



 
Msg#: 2051 posted 6:06 pm on Mar 21, 2005 (gmt 0)

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

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



 
Msg#: 2051 posted 7:02 pm on Mar 21, 2005 (gmt 0)

take out the "unescape" from the processing script.

isaaclloyd

5+ Year Member



 
Msg#: 2051 posted 2:50 am on Mar 22, 2005 (gmt 0)

Actually heres what I found to work:


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

Thanks,

~Isaac Lloyd~

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved