homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

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

10+ Year Member

Msg#: 373 posted 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

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





WebmasterWorld Senior Member 10+ Year Member

Msg#: 373 posted 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!


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

Msg#: 373 posted 3:32 am on Apr 18, 2003 (gmt 0)


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