Thanks Viper... I've sent the html off to myf riend for checking...
I actually found some other code while searching that may work for you... I'll try get it working for your original code but this might be helpful:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Form enabler/disabler</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
ElemID = new Array()
ElemID[0] = ["q","qw","qwe"]
ElemID[1] = ["q","a"]
flag = false
function disableFrm(ElemIDGroup) {
flag = !flag
for (i=0; i<ElemID.length; i++)
{
for (j=0; j<ElemID[ElemIDGroup].length; j++)
{
document.getElementById(ElemID[ElemIDGroup][j]).disabled = flag
}
}
}
</script>
</head>
<body>
<select id="ElemIDGroup">
<option value="0">Group 1</option>
<option value="1">Group 2</option>
</select>
<input type="button" value="disable/enable form" onclick="disableFrm(document.getElementById('ElemIDGroup').value)" /><br />
<form method="get" action="file.php">
name: <input type="text" id="q" /><br />
<textarea id="qw"></textarea><br />
<input type="button" id="qwe" value="random button" onclick="alert('hello')" /><br />
<select id="a">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option value="d">d</option>
</select>
<input type="submit" /><input type="reset" />
</form>
</body>
</html>
Example of an alternative to the other solution:
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--
function lock(obj){
obj=document.getElementById(obj);
if (obj.getAttribute('disabled')){
obj.removeAttribute('disabled');
}
else {
obj.setAttribute('disabled','disabled');
}
}
//-->
</script></head>
<body>
<select id="fred" size="1" disabled="disabled" >
<option>jan
<option>feb
<option>march
</select>
<input type="checkbox" checked=true name="" onclick="javascript:lock('fred');" >
</body>
Hope the helps... I will see if I can get code for your html... Let me know if this works though
