Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q687 How can I include today's date in the url of a link?

You are here: irt.org | FAQ | JavaScript | Link | Q687 [ previous next ]

Try:

<SCRIPT LANGUAGE = 'JavaScript'><!--
function xx(number) { return (number < 10) ? '0' + number : number; }
var date = new Date();
var dd=xx(date.getDate()), mm=xx(date.getMonth()+1), yy=xx(date.getYear());

document.write(day + "/" + month + "/" + year);
//--></SCRIPT>

<A HREF="http://www.irt.org/" onClick="this.href='http://www.irt.org/' + mm + dd + yy + '.htm'">today</A>

©2018 Martin Webb