...

View Full Version : show hide text box



extremed
11-12-2010, 10:44 AM
Hi

Im looking for a way to show hide text box on select option change




<select name="letter_type" id="lt">
<option value="Registered">Registered</option>
<option selected="selected" value="Unregistered">Unregistered</option></select>
<input name="textfield7" id="regty" type="text" accesskey="1" tabindex="1" size="20" />


i wana show that text box if user select "Registered" from select option.

any help would be great



sorry for language errors.

Thanks

Philip M
11-12-2010, 10:58 AM
Here you are:-


<select name="letter_type" id="lt" onchange = "show()">
<option value="Registered">Registered</option>
<option selected="selected" value="Unregistered">Unregistered</option>
</select>
<br><br>
<div id = "mydiv" style="display:none">
<input name="textfield7" id="regty" type="text" accesskey="1" tabindex="1" size="20" />
</div>

<script type = "text/javascript">

function show() {
var val = document.getElementById("lt").value;
if (val == "Registered") {
document.getElementById("mydiv").style.display="block";
}
else {
document.getElementById("mydiv").style.display="none";
}
}

</script>

Quizmaster: Which animal do we get vension from?
Contestant: Snakes.

extremed
11-12-2010, 12:57 PM
Thanks a lot

extremed
11-12-2010, 01:05 PM
Thanks a lot

Philip M
11-12-2010, 01:32 PM
WWhhaatt ddooeess dduupplleexx mmeeaann?? :D:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum