|
-
Jan 28th, 2003, 09:01 AM
#1
Thread Starter
Lively Member
Disable textbox when ListIndex = 2
I have 2 Select Boxes...
I put an OnChange event on the First Select box....
If the first listbox' ListIndex = 2...I'd like the second two be disabled...
If the ListIndex changes again...I want to enable the second listbox...
The below code does the disabling....but does not check for listindex..help is appreciated
Code:
function disablen(veld){
with (document.myForm.elements[veld]) {
disabled = !disabled;
}
}
-
Jan 28th, 2003, 10:26 AM
#2
Conquistador
Code:
<script language="javascript">
function Lists(){
alert(form1.select.selectedIndex);
if(form1.select.selectedIndex==2){
form1.select2.disabled = 1;
form1.select3.disabled = 1;
} else {
form1.select2.disabled = 0;
form1.select3.disabled = 0;
}
}
</script>
<form name="form1" method="post" action="">
<select name="select" onChange="Lists();">
<option selected>test</option>
<option>disable</option>
<option>test3</option>
</select>
<select name="select2">
<option selected>test</option>
<option>test2</option>
<option>test3</option>
<option>test4</option>
<option>test5</option>
</select>
<select name="select3">
<option selected>test</option>
<option>test2</option>
<option>test3</option>
<option>test4</option>
</select>
</form>
Don't forget the index starts at 0
-
Feb 1st, 2003, 09:42 AM
#3
Conquistador
did this work satisfactorily for you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|