Quote:
Originally Posted by gits
glad to hear you solved your problem ... may be you could just drop a short note regarding your solution ... just for the users that may find this thread in the future and have a similar problem?
kind regards
Ok, no problem.
Some people won't like me using id values here but I will in this case for simplicity's sake:
-
<select id="FRG_FNC" size="1" name="FRG_FNC">
-
<option value="">Select value</option>
-
<option value="FRC">FRG</option>
-
<option value="FNC">FNC</option>
-
<option value="No">No</option>
-
</select>
-
-
-
<select id="core" size="1" name="core">
-
<option value="">Select value</option>
-
<option value="Yes">Yes</option>
-
<option value="No">No</option>
-
</select>
-
-
<input id="code" type="text" name="code" size="10" readonly value="-"
-
In an external .js file which you'll link to in the head of your html page write:
-
window.onload = initSelects;
-
-
function initSelects() {
-
var sel1 = document.getElementById("FRG_FNC");
-
if (sel1) {
-
sel1.onchange = sel1Change;
-
}
-
var sel2 = document.getElementById("core");
-
if (sel2) {
-
sel2.onchange = sel2Change;
-
}
-
}
-
function sel1Change() {
-
var sel2 = document.getElementById("core");
-
var code = document.getElementById("code");
-
if (this.selectedIndex === 3) {
-
sel2.selectedIndex = 2;
-
sel2.disabled = true;
-
code.value = "default";
-
code.disabled = true;
-
} else {
-
sel2.selectedIndex = 0;
-
sel2.disabled = false;
-
code.value = "";
-
code.disabled = false;
-
}
-
}
-
function sel2Change() {
-
var cc = this.options[this.selectedIndex].value;
-
if(cc === 'No') Forum();
-
}
-
kind regards
viki