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

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';
}
//--></SCRIPT>

<FORM>
<SELECT NAME="year">
<OPTION>1996
<OPTION>1997
<OPTION>1998
<OPTION>1999
<OPTION>2000
</SELECT>

<SELECT NAME="month">
<OPTION VALUE="01">January
<OPTION VALUE="02">February
<OPTION VALUE="03">March
<OPTION VALUE="04">April
<OPTION VALUE="05">May
<OPTION VALUE="06">June
<OPTION VALUE="07">July
<OPTION VALUE="08">August
<OPTION VALUE="09">September
<OPTION VALUE="10">October
<OPTION VALUE="11">November
<OPTION VALUE="12">December
</SELECT>

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

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

©2018 Martin Webb