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

Q1795 How can I allow the user to combine one option from radio buttons and one option from list and then press submit button to open respective selected webpage??

You are here: irt.org | FAQ | JavaScript | Form | 10.1 | Q1795 [ previous next ]

With the following you can open 1 of 36 files, where the file names for January are jan07.htm, jan08.htm, jan09.htm and similar file names for all other months:

<select name="month">
<option value="jan">January
<option value="feb">February
<option value="mar">March
<option value="apr">April
<option value="may">May
<option value="jun">June
<option value="jul">July
<option value="aug">August
<option value="sep">September
<option value="oct">October
<option value="nov">November
<option value="dec">December
<input type="radio" name="r1" value="07" checked>2007<br>
<input type="radio" name="r1" value="08">2008<br>
<input type="radio" name="r1" value="09">2009<br>
<input type="button"
onClicK="window.location=calculatePageName(this.form);return false" value="Go">

<script lanaguage="javaScript"><!--
function calculatePageName(form) {
  for (i=0;i<form.r1.length;i++) {
    if (form.r1[i].checked) val = form.r1[i].value;
  return form.month.options[form.month.selectedIndex].value+val+'.htm'

©2018 Martin Webb