Hey all,
I have the following HTML, adapted from a more complicated one I'm creating;
<HTML>
<HEAD>
<SCRIPT TYPE="TEXT/JAVASCRIPT">
function setup(ans) {
lit = ''
if (ans == 'anim') {
lit = '<br><br>How many legs? '
lit = lit + '<SELECT NAME="q2" ONCHANGE="print(document.quest.q2.value)">'
lit = lit + '<OPTION VALUE="">- Please select -</OPTION>'
lit = lit + '<OPTION VALUE="Cat">4</OPTION>'
lit = lit + '<OPTION VALUE="Sparrow">2</OPTION>'
lit = lit + '<OPTION VALUE="Snake">0</OPTION>'
lit = lit + '</SELECT>'
}
if (ans == 'min') {
lit = '<br><br>What colour? '
lit = lit + '<SELECT NAME="q2" ONCHANGE="print(document.quest.q2.value)">'
lit = lit + '<OPTION VALUE="">- Please select -</OPTION>'
lit = lit + '<OPTION VALUE="Emerald">Green</OPTION>'
lit = lit + '<OPTION VALUE="Ruby">Red</OPTION>'
lit = lit + '<OPTION VALUE="Sapphire">Blue</OPTION>'
lit = lit + '</SELECT>'
}
if (ans == 'elem') {
lit = '<br><br>What kind of element? '
lit = lit + '<SELECT NAME="q2" ONCHANGE="print(document.quest.q2.value)">'
lit = lit + '<OPTION VALUE="">- Please select -</OPTION>'
lit = lit + '<OPTION VALUE="Helium">Noble gas</OPTION>'
lit = lit + '<OPTION VALUE="Fluorine">Halogen</OPTION>'
lit = lit + '<OPTION VALUE="Lithium">Alkali metal</OPTION>'
lit = lit + '</SELECT>'
}
document.getElementById('rep').innerHTML=lit
}
function print(statement) {
document.getElementById('prt').innerHTML='<H3>You have chosen ' + statement
}
</SCRIPT>
</HEAD>
<BODY>
<FORM ACTION="#" NAME=quest>
What is it? <SELECT NAME="q1" ONCHANGE="setup(document.quest.q1.value)">
<OPTION VALUE="">- Please select -</OPTION>
<OPTION VALUE="anim">Animal</OPTION>
<OPTION VALUE="min">Mineral</OPTION>
<OPTION VALUE="elem">Element</OPTION>
</SELECT>
<SPAN ID="rep"></SPAN>
<SPAN ID="prt"></SPAN>
</FORM>
</BODY>
</HTML>
The problem is that on refreshing the page, the "What is it?" drop-down box keeps the previously selected value. Is there any way to have the value in the box set to the default "-Please select-" text?
Thanks in advance guys!