Print Page | Close Window

Combo box js function

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Web Design Discussion
Forum Description: Discussion on web design and development subjects.
URL: https://forums.webwiz.net/forum_posts.asp?TID=14684
Printed Date: 29 March 2026 at 7:01pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Combo box js function
Posted By: ub3rl337ch3ch
Subject: Combo box js function
Date Posted: 14 April 2005 at 1:37am
i have a javascript function dc1dc2() which i am calling with an onchange event. The idea is supposed to be that when the combobox DC1 has yes (the first option) selected, no (the second option) will be selected in DC2. brdform2 is the name of the form they're in, obviously.
 
This is how i figure it should work, but nothing happens, not even an error:
 
function dc1dc2(){
if (document.brdform2.DC1.options[0].selected=='True'){
document.brdform2.DC2.options[1].selected='True';
}else{
document.brdform2.DC2.options[0].selected='True';
}}
 
The below does the exactly wrong thing, in that when i select yes in DC1, it selects yes in DC2, and the same for no.
 
function dc1dc2(){
if (document.brdform2.DC1.options[0].selected=='True'){
document.brdform2.DC2.options[document.brdform2.DC1.selectedIndex].selected='False';
}else{ document.brdform2.DC2.options[document.brdform2.DC1.selectedIndex].selected='True';
}}
 
any ideas as to what's going on? or how i can get it to work?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net