modify the default option in a select changing another select

W

WebRaster

I wish to know if is possible to change the selected option in a SELECT
selecting a determined option into another SELECT in the same form.


E.g: When I select the option "Istruction" in the SELECT named "A" I wish
the SELECT "B" change the default state from "empty" to "other"

Thank You
 
F

Francisco Spaeth

Here is a litle example of...
<html>

<body onload="changeEvent()">

<script language="JavaScript">
<!--
function changeEvent() {
if (document.forms[0].items.selectedIndex == 0)
document.forms[0].subItems.selectedIndex = 1;
if (document.forms[0].items.selectedIndex == 1)
document.forms[0].subItems.selectedIndex = 0;
}
-->
</script>

<form method="POST" action>
<p><select size="1" name="items" onchange="changeEvent()">
<option>Item1</option>
<option>Item2</option>
</select><select size="1" name="subItems">
<option>SubItem1</option>
<option>SubItem2</option>
</select></p>
</form>
</body>

</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top