Query strings and JavaScript?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
cturner
Forum Contributor
Posts: 153
Joined: Sun Jul 16, 2006 3:03 am
Location: My computer

Query strings and JavaScript?

Post by cturner »

Can someone please tell me how I can make a query string in JavaScript?

I want the following to be changed to a query string:

Code: Select all

      var y = calendar.date.getFullYear();
      var m = calendar.date.getMonth();     // integer, 0..11
      var d = calendar.date.getDate();      // integer, 1..31
      // redirect...
      window.location = "/" + y + "/" + m + "/" + d + "/calendar.php";
Thanks in advance.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

How is it supposed to change?
User avatar
cturner
Forum Contributor
Posts: 153
Joined: Sun Jul 16, 2006 3:03 am
Location: My computer

Post by cturner »

The code comes from a calendar and when someone clicks on a day it is suppose to go to another page. I need it to go to another page so the other page can display some information for that date.
User avatar
cturner
Forum Contributor
Posts: 153
Joined: Sun Jul 16, 2006 3:03 am
Location: My computer

Post by cturner »

I have solved it myself. The solution is:

Code: Select all

window.location = "calendar.php?day=" + d + "&month=" + m + "&year=" + y;
for anyone that needs to know.
Post Reply