Click to See Complete Forum and Search --> : how to create a dynamic URL?


Leornung
03-12-2003, 01:42 PM
I want to use JavaScript to create a URL from a strring and a date, but I haven't been able to do it successfully. For example, I want to do something like this:

onclick='"/myAction.do?dtg=" + new Date().getTime()'

so the actual RUL will be: /myAction.do?dtg=1234567

Any suggestions?

Nevermore
03-12-2003, 01:44 PM
Try this:

action = new String('"/myAction.do?dtg="');
date=new String(new Date().getTime());
actiondate=action + date;

Leornung
03-12-2003, 01:58 PM
Thanks. Although it didn't work directly, a slight modification made it work just fine:

onclick='window.location=appendDate(\'myAction.do?dtg=\')'

and I used your code in my appendDate().

Nevermore
03-12-2003, 02:02 PM
Glad to have been of even a little help.