hantz
11-13-2007, 09:51 AM
imagen you got a 1 select box(place)
and underneath 5 other select boxes(day/month/year/hour/minute)
as default those 5 select boxes are blind...blind this means that somehow they got gray colored...i am not sure how to decribe it but that is not just that you can't touch those fields they kind of gray scaled...
and only 2 options from the first select list can bring those 5 select boxes to life...that means that the blind\gray will disappear and user will be able to select them...
this code doing the same but with checkbox...if the box is checked it enables the 5 selects...
i need to use anoter select box that only 2 of it's options will enable the other 5 select boxes
<script type="text/javascript">
function enableDisable(oChk){
var disable = !oChk.checked;
var arglen = arguments.length;
var obj, startIndex = 1;
var frm = oChk.form;
for (var i=startIndex;i<arglen;i++){
obj = frm.elements[arguments[i]];
if (typeof obj=="object"){
if (document.layers) {
if (disable){
obj.onfocus=new Function("this.blur()");
if (obj.type=="text") obj.onchange=new Function("this.value=this.defaultValue");
}
else {
obj.onfocus=new Function("return");
if (obj.type=="text") obj.onchange=new Function("return");
}
}
else obj.disabled=disable;
}
}
}
</script>
</head>
<body>
<form name="example1">
Enable/Disable Fields: <input type="checkbox" name="control1" onclick="enableDisable(this,'day','month','year','hour','min')" />
<br />
day <select name="day" disabled="disabled" />
<option>option1</option>
</select>
month <select name="month" disabled="disabled" />
<option>option1</option>
</select>
year <select name="year" disabled="disabled" />
<option>option1</option>
</select>
hour <select name="hour" disabled="disabled" />
<option>option1</option>
</select>
min <select name="min" disabled="disabled" />
<option>option1</option>
</select>
</form>
and underneath 5 other select boxes(day/month/year/hour/minute)
as default those 5 select boxes are blind...blind this means that somehow they got gray colored...i am not sure how to decribe it but that is not just that you can't touch those fields they kind of gray scaled...
and only 2 options from the first select list can bring those 5 select boxes to life...that means that the blind\gray will disappear and user will be able to select them...
this code doing the same but with checkbox...if the box is checked it enables the 5 selects...
i need to use anoter select box that only 2 of it's options will enable the other 5 select boxes
<script type="text/javascript">
function enableDisable(oChk){
var disable = !oChk.checked;
var arglen = arguments.length;
var obj, startIndex = 1;
var frm = oChk.form;
for (var i=startIndex;i<arglen;i++){
obj = frm.elements[arguments[i]];
if (typeof obj=="object"){
if (document.layers) {
if (disable){
obj.onfocus=new Function("this.blur()");
if (obj.type=="text") obj.onchange=new Function("this.value=this.defaultValue");
}
else {
obj.onfocus=new Function("return");
if (obj.type=="text") obj.onchange=new Function("return");
}
}
else obj.disabled=disable;
}
}
}
</script>
</head>
<body>
<form name="example1">
Enable/Disable Fields: <input type="checkbox" name="control1" onclick="enableDisable(this,'day','month','year','hour','min')" />
<br />
day <select name="day" disabled="disabled" />
<option>option1</option>
</select>
month <select name="month" disabled="disabled" />
<option>option1</option>
</select>
year <select name="year" disabled="disabled" />
<option>option1</option>
</select>
hour <select name="hour" disabled="disabled" />
<option>option1</option>
</select>
min <select name="min" disabled="disabled" />
<option>option1</option>
</select>
</form>