homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Getting input field information with JavaScript
dreaming of nascar




msg:1490065
 12:59 am on Apr 18, 2003 (gmt 0)

I was wondering how you get JS to get the input field information (I am not sure if I am calling that correctly). What I mean is that you have an address like www.something.com and when you submit a form, you go to
www.something.com/whatever.htm?blah=blah&blah=blah

What I want to know is how do you read the blah=blah&blah=blah into JS. I hope that this makes sense.

Thanks

D O N

 

rainborick




msg:1490066
 3:29 am on Apr 18, 2003 (gmt 0)

The information you're after is generally called the Query String. The query string can be accessed via the "location.search" property in JavaScript. Apparently all of the people who have been enhancing JavaScript over the last few years are also Perl programmers, because there are several functions/techniques that are commonly used in Perl for manipulating this information in form-handling cgi scripts that are also available in JavaScript. For example, the "split" function makes it simple to parse the parameters in the query string and subsequently the name/value pairs. Good luck!

DrDoc




msg:1490067
 3:32 am on Apr 18, 2003 (gmt 0)

www.something.com/page.html?blah=whatever

a = location.search.substring(1);

a is now "blah=whatever"...





...and that's 1000 :o

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
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