I'm trying to replace a drop down menu I have with a text field if someone chooses the "other" option. Right now in my code I have it replacing it with a paragraph element because I'm too lazy to find the exact constructor arguments for setting up a text field. However, when "other" is selected nothing happens.
Does anyone know what's wrong with this?
<html>
<head>
<script type="text/javascript">
function testfunc(arg) {
if(arg.value == "other") {
document.thing.replaceChild(document.test, document.thing.selection)
}
else {
alert("stuff")
}
}
</script>
<body>
<form name="thing">
<select name="selection" onchange="testfunc(document.thing.selection.options[document.thing.selection.selectedIndex])">
<option>yes</option>
<option>no</option>
<option>other</option>
</select>
</form>
<p name="test">lkjsdf</p>
</body>
</html>