469,304 Members | 2,018 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,304 developers. It's quick & easy.

modify the default option in a select changing another select

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
Oct 26 '05 #1
1 1799
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>

Oct 26 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Askari | last post: by
3 posts views Thread by Sarah West | last post: by
2 posts views Thread by Rani | last post: by
8 posts views Thread by Alan J. Flavell | last post: by
2 posts views Thread by niels.froehling | last post: by
19 posts views Thread by deko | last post: by
4 posts views Thread by rn5a | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.