Click to See Complete Forum and Search --> : Hidden Textbox
Sonia
07-23-2003, 03:11 AM
Hi there, I'm having a small problem with Javascript. I would like to know how make a hidden textbox visible when I select an option from a dropdown menu. For e.g I have a dropdown menu on Country. If I select 'Others' , the others textbox should appear (it was hidden previously).
Please can u help me. It's very important!!!
Plz Plz Plz
Sonia
skriptor
07-23-2003, 04:59 AM
Hi,
try something like this:
<html><head>
<script type="text/javascript" language="JavaScript">
function show( selTag ) {
obj = document.getElementById("other");
if ( selTag.selectedIndex == 1 ) {
obj.style.display = "block";
} else {
obj.style.display = "none";
}
}
</script></head><body>
<form action="">
<select name"state1" size="1" style="width=180" onchange="show( this )">
<option value="1" selected>Germany</option>
<option value="0">Other</option>
</select>
<select id="other" name="state2" size="1" style="width=180;display:none">
<option value="2" selected>Suomi</option>
<option value="3">Belgium</option>
</select>
</form>
</body></html>
Good luck, skriptor
Sonia
07-23-2003, 06:36 AM
Thank you very very much Skriptor!!!