Morning. Ive got the following code below which is being used to only enable a 2nd dropdown depending on the value of the 1st dropdown, at the moment however it also activating the last option in the dorpdown for some reason, the information is being pulled from a database, the code is below
Quote:
<script type="text/javascript">
function dd_enabledist() {
endist = document.getElementById('howheard_id');
disty = document.getElementById('distributor');
if (endist && disty) {
hhval = endist.options[endist.selectedIndex].value;
if ( hhval.toString() <= 4 ) {
// Enable the textbox
disty.disabled = false;
} else {
// Disable the textbox
disty.disabled = true;
}
}
}
// Run the function for onLoad
dd_enabledist();
</script>
|
The dropdown code is below, however its irrlevant here I think for the problem im having
Quote:
|
<select name="howheard_id" id="howheard_id" onchange="dd_howheard(); dd_enabledist();" <%if ind_type_id=2 then response.write "disabled=""true""" end if%>><%=GetSelect("SELECT howheard_id,howheard_text FROM Howheard_Lang WHERE howheard_live=1 and lang_id = " & session("lang_id")& " ORDER BY howheard_order", session("howheard_id")) %></select>
|
What I want to do is try and change the javascript so it is above the value of 1 and less than or equal to 4, it must be simple but im having problems with it, if I change it to ==2 on the hhval it works fine, but there are 3 values in the dropdown that need to activate the 2nd dropdown
Appreicated any help
Thanks
Mat