• Home
  • About
Blue Orange Green Pink Purple

Working with query strings in Javascript using Prototype

Posted in code. on Wednesday, September 30th, 2009 by Chris Hulbert
Sep 30

Here's a bit of javascript that uses query strings. It parses the query string into a dictionary object called params, tests if a certain parameter was passed, and if it was passed it fills in a couple of input boxes with the passed values.

  var params = window.location.search.toQueryParams();
  if (!(params.dt===undefined)) // Was the 'dt' param passed?
  {
    $('date').value = params.dt;
    $('amount').value = params.amount; // assume the 'amount' was given
  }

Leave a Reply

Chris' Babble

  • About
    Hi, i'm Chris Hulbert, a software guy from Sydney Australia.
  • Categories
    • code
    • Portfolio
    • Uncategorized
  • Recent Articles
    • How to implement DES and Triple DES from scratch
    • How to use Cookies in Struts 2 with ServletRequest and ServletResponse
    • How to use sessions with Struts 2
    • Using Quartz Scheduler in a Java web app (servlet)
    • Javascript date picker that Doesn't Suck!(tm)
    • Using Oracle XE with Hibernate


  • Home
  • About

© Copyright Chris' Babble. All rights reserved.
Designed by FTL Wordpress Themes brought to you by Smashing Magazine

Back to Top