You are here: irt.org | FAQ | JavaScript | Form | 10.3 | Q15 [ previous next ]
Use the following on the source page:
<form> <select name="selectName"> <option>January <option>February <option>March <option>April <option>May <option>June <option>July <option>August <option>Spetember <option>October <option>November <option>December </select> <input type="button" value="Go" onClick="window.location.href = 'nextpage.html?' + this.form.selectName.options[this.form.selectName.selectedIndex].text"> </form>
And the following on the nextpage.html:
<form name="formName"><input type="text" name="textName"></form> <script language="JavaScript"><!-- document.formName.textName.value = location.search.substring(1); //--></script>
Or, alternatively:
<script language="JavaScript"><!-- document.write("<form><input type='text' "); document.write("value='"+location.search.substring(1)+"'><\/form>"); //--></script>
As this code passes data in the location object's search property, it does not work offline in Internet Explorer 4.