Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q814 Is it possible to accept the year, month and activity from a form an then load the relevant index page page from an activity subdirectory within a month subdirectory with a year subdirectory, e.g. 1996/09/running/index.htm?

You are here: irt.org | FAQ | JavaScript | Date | Q814 [ previous next ]

Try the following:

<SCRIPT LANGUAGE="JavaScript"><!--
function getPage(what) {
    var year = what.year.options[what.year.selectedIndex].text;
    var month = what.month.options[what.month.selectedIndex].value;
    var activity = what.activity.options[what.activity.selectedIndex].value;
    location.href = year + '/' + month + '/' + activity + '/index.htm';

<SELECT NAME="year">

<SELECT NAME="month">
<OPTION VALUE="01">January
<OPTION VALUE="02">February
<OPTION VALUE="03">March
<OPTION VALUE="04">April
<OPTION VALUE="08">August
<OPTION VALUE="09">September
<OPTION VALUE="10">October
<OPTION VALUE="11">November
<OPTION VALUE="12">December

<SELECT NAME="activity">
<OPTION VALUE="running">Running
<OPTION VALUE="walking">Walking
<OPTION VALUE="swimming">Swimming
<OPTION VALUE="cycling">Cycling

<INPUT TYPE="BUTTON" VALUE="Submit" onClick="getPage(this.form)">

©2018 Martin Webb