nikko50
10-23-2005, 07:14 AM
Hello all. How can I get the below script to work with rows. Vic gave me this script and it works great if you use the span tags but I'm trying to get to get this to work when text areas are contained in table rows. Please help. If you're out there Vic please help.
Tracy:)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--
// by Vic Phillips http://www.vicsjavascripts.org.uk/
function Disable(obj,state){
clds=obj.parentNode.childNodes;
if (!obj.ary){
obj.ary=new Array();
for (i1=0;i1<clds.length;i1++){
if (clds[i1].tagName=='INPUT'||clds[i1].tagName=='SELECT'||clds[i1].tagName=='TEXTAREA'){
obj.ary[obj.ary.length]=clds[i1];
}
}
}
for (i=0;i<obj.ary.length;i++){
obj.ary[i].removeAttribute('disabled');
}
if (obj.checked==state){
for (i1=0;i1<obj.ary.length;i1++){
obj.ary[i1].setAttribute('disabled','disabled');
}
}
obj.removeAttribute('disabled');
}
//-->
</script>
</head>
<body>
<span >
<input type="checkbox" name="" disabled >
<input type="text" name="" disabled >
<select disabled ><option>Select</option></select>
<input type="checkbox" name="" onclick="Disable(this,false);" > Disable/Enable
</span>
<br>
<span >
<input type="checkbox" name="" disabled >
<input type="text" name="" disabled >
<select disabled ><option>Select</option></select>
<input type="checkbox" name="" onclick="Disable(this,false);" > Disable/Enable
</span>
<br>
<br>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<span > <tr>
<td width="50%"><input type="text" name="" disabled ></td>
<td width="25%"><select disabled ><option>Select</option></select>
</td>
<td width="25%"><input type="checkbox" name="" onclick="Disable(this,false);" > Disable/Enable
</td>
</tr></span>
<span><tr>
<td width="50%"><input type="text" name="" disabled ></td>
<td width="25%"><select disabled ><option>Select</option></select>
</td>
<td width="25%"><input type="checkbox" name="" onclick="Disable(this,false);" > Disable/Enable
</td>
</tr></span>
</table>
</center>
</div>
</body>
</html>
Tracy:)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--
// by Vic Phillips http://www.vicsjavascripts.org.uk/
function Disable(obj,state){
clds=obj.parentNode.childNodes;
if (!obj.ary){
obj.ary=new Array();
for (i1=0;i1<clds.length;i1++){
if (clds[i1].tagName=='INPUT'||clds[i1].tagName=='SELECT'||clds[i1].tagName=='TEXTAREA'){
obj.ary[obj.ary.length]=clds[i1];
}
}
}
for (i=0;i<obj.ary.length;i++){
obj.ary[i].removeAttribute('disabled');
}
if (obj.checked==state){
for (i1=0;i1<obj.ary.length;i1++){
obj.ary[i1].setAttribute('disabled','disabled');
}
}
obj.removeAttribute('disabled');
}
//-->
</script>
</head>
<body>
<span >
<input type="checkbox" name="" disabled >
<input type="text" name="" disabled >
<select disabled ><option>Select</option></select>
<input type="checkbox" name="" onclick="Disable(this,false);" > Disable/Enable
</span>
<br>
<span >
<input type="checkbox" name="" disabled >
<input type="text" name="" disabled >
<select disabled ><option>Select</option></select>
<input type="checkbox" name="" onclick="Disable(this,false);" > Disable/Enable
</span>
<br>
<br>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<span > <tr>
<td width="50%"><input type="text" name="" disabled ></td>
<td width="25%"><select disabled ><option>Select</option></select>
</td>
<td width="25%"><input type="checkbox" name="" onclick="Disable(this,false);" > Disable/Enable
</td>
</tr></span>
<span><tr>
<td width="50%"><input type="text" name="" disabled ></td>
<td width="25%"><select disabled ><option>Select</option></select>
</td>
<td width="25%"><input type="checkbox" name="" onclick="Disable(this,false);" > Disable/Enable
</td>
</tr></span>
</table>
</center>
</div>
</body>
</html>