How to Use a JavaScript Query String Parser

By Joseph Myers

http://www.htmlgoodies.com/beyond/javascript/article.php/11877_3755006_3/How-to-Use-a-JavaScript-Query-String-Parser.htm (Back to article)

You may be saying, "That's great. How do I use it?" It's very, very easy.

Note: The script probably won't work on your local computer if you have a recent browser. Due to cross-site scripting vulnerabilities some browsers won't load the files from myjs.us when they're used in a local file, due to the possibility of malicious scripts accessing local files.

An example of output from the query string:

is this:

Another Example

You can see an example of a form which submits information to itself and uses JavaScript to produce dynamic behavior after interpreting the query string by looking at the JavaScript Form Processor.

A copy of the code is here:

Conclusion

If you have questions at all, please send me an e-mail (e_mayilme[at]hotmail.com) or visit my Web site.

This article originally appeared on WebReference.com.