Hi guys,
I've got the following, very basic, working DHTML;
<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="alert(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="alert(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="alert(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
}
</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>
</FORM>
</BODY>
</HTML>
But I want the final answer to come up as text on the screen rather than as an alert pop-up. Any idea on how I'd do this? I'm very new to web development (been working on it for a day) so any help would be much appreciated. Thanks!