Current date in URL?

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
zorigo
Beginner
Beginner
Posts: 2
Joined: Wed Nov 05, 2003 4:18 pm

Current date in URL?

Post by zorigo »

is there a way to include the current date in a URL in a menu? I can't seem to get it to work correctly

Here is my code:

aI("text=My Appointments;url=Calendar.asp?WeekID="Document.Write(now)";");

The date format should be mm/dd/yyyy
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Code: Select all

<SCRIPT>
now = new Date();
today = (now.getMonth()+1) + "/" + now.getDate() + "/" + now.getFullYear();
....
....
aI("text=Item1;url=/somedir/somepage.asp?query1=" + today + ";");
....
</SCRIPT>
Haven't gotten a chance to test this but this is the general direction I would take. The menu item definition is essentially just a string, so you can start and stop it while inside the aI so when you get the query string part, you stop the string, concatinate it with the today-string and then concatinate that with the rest of the menu stuff and close the aI.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
zorigo
Beginner
Beginner
Posts: 2
Joined: Wed Nov 05, 2003 4:18 pm

Post by zorigo »

That worked perfectly! Thanks Dave!
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Hot dang! I think that brings my total of working scripts to like 2, maybe 3! Yahoo! :lol: Glad it worked! As I said, I didnt test it...so it makes it more interesting to see what you say afterwards! Best of luck with the Milonic DHTML Menu!!
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply