<input type="checkbox" onclick="document.getElementById('tblFrm').disabled=!this.checked">
<table id="tblFrm" disabled width="80%" height="125" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr><FORM name="admin" method="post" action="xitongok.php">
<td height="125" ><table width="87%" height="73" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="44%" height="24" align="right" >IP地址:</td>
<td width="56%" align="left" ><input name="ip" type="text" id="ip" value="<?php echo $ip?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td width="44%" height="24" align="right" >子网掩码:</td>
<td width="56%" align="left" ><input name="netmask" type="text" id="netmask" value="<?php echo $netmask?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td width="44%" height="24" align="right" >默认网关:</td>
<td width="56%" align="left" ><input name="gateway" type="text" id="gateway" value="<?php echo $gateway?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td height="24" align="right" >服务器别名:</td>
<td align="left" ><input name="servername" type="text" id="servername" value="<?php echo $servername;?>" /></td>
</tr>
</table>
<table width="87%" height="24" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="25" align="center" ><input name="tijiao" type="submit" class="btn" border="0" value="确 定">
</td>
</tr>
</table></td></FORM>
<script type="text/javascript">
function lock(obj){
var inputs = document.admin.getElementsByTagName("input");
for(var i=0; i<inputs.length; i++){
if(inputs[i].type == "text"){
inputs[i].disabled = obj.checked;
}
}
}
</script>
<legend> 网络设置 </legend>
<table width="80%" height="125" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr><FORM name="admin" method="post" action="xitongok.php">
<?php
$fp= fopen("/www/imgserver/setting.cfg","r");
fscanf($fp,"[network]");
fscanf($fp,"nic=nic0");
fscanf($fp,"[nic0]");
fscanf($fp,"dhcp=1");
fscanf($fp,"ip=%s",$ip);
fscanf($fp,"mac=00-0C-E0-F0-3C-0F");
fscanf($fp,"netmask=%s",$netmask);
fscanf($fp,"gateway=%s",$gateway);
fscanf($fp,"[server]");
fscanf($fp,"name=%s",$servername);
fscanf($fp,"[control]");
fscanf($fp,"restart=0");
fclose($fp);
?>
<td height="125" ><table width="87%" height="73" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="44%" height="24" align="right" >IP地址:</td>
<td width="56%" align="left" ><input name="ip" type="text" id="ip" value="<?php echo $ip?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td width="44%" height="24" align="right" >子网掩码:</td>
<td width="56%" align="left" ><input name="netmask" type="text" id="netmask" value="<?php echo $netmask?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td width="44%" height="24" align="right" >默认网关:</td>
<td width="56%" align="left" ><input name="gateway" type="text" id="gateway" value="<?php echo $gateway?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td height="24" align="right" >服务器别名:</td>
<td align="left" ><input name="servername" type="text" id="servername" value="<?php echo $servername;?>" /></td>
</tr>
</table>
<table width="87%" height="24" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="25" align="center" ><input name="tijiao" type="submit" class="btn" border="0" value="确 定"> <input type="checkbox" value="1" id="chkLock" onclick="lock(this)" name="chkLock" /><label for="chkLock">锁定</label>
</td>
</tr>
</table></td></FORM>
<script type="text/javascript">
function lock(obj){
var inputs = document.admin.getElementsByTagName("input");
for(var i=0; i<inputs.length; i++){
if(inputs[i].type == "text"){
inputs[i].disabled = !obj.checked;
}
}
}
window.onload = function(){
document.getElementById("chkLock").checked = true;
document.getElementById("chkLock").click();
}
</script>
<legend> 网络设置 </legend>
<table width="80%" height="125" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr><FORM name="admin" method="post" action="xitongok.php">
<?php
$fp= fopen("/www/imgserver/setting.cfg","r");
fscanf($fp,"[network]");
fscanf($fp,"nic=nic0");
fscanf($fp,"[nic0]");
fscanf($fp,"dhcp=1");
fscanf($fp,"ip=%s",$ip);
fscanf($fp,"mac=00-0C-E0-F0-3C-0F");
fscanf($fp,"netmask=%s",$netmask);
fscanf($fp,"gateway=%s",$gateway);
fscanf($fp,"[server]");
fscanf($fp,"name=%s",$servername);
fscanf($fp,"[control]");
fscanf($fp,"restart=0");
fclose($fp);
?>
<td height="125" ><table width="87%" height="73" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="44%" height="24" align="right" >IP地址:</td>
<td width="56%" align="left" ><input name="ip" type="text" id="ip" value="<?php echo $ip?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td width="44%" height="24" align="right" >子网掩码:</td>
<td width="56%" align="left" ><input name="netmask" type="text" id="netmask" value="<?php echo $netmask?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td width="44%" height="24" align="right" >默认网关:</td>
<td width="56%" align="left" ><input name="gateway" type="text" id="gateway" value="<?php echo $gateway?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td height="24" align="right" >服务器别名:</td>
<td align="left" ><input name="servername" type="text" id="servername" value="<?php echo $servername;?>" /></td>
</tr>
</table>
<table width="87%" height="24" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="25" align="center" ><input name="tijiao" type="submit" class="btn" border="0" value="确 定"> <input type="checkbox" value="1" id="chkLock" onclick="lock(this)" name="chkLock" /><label for="chkLock">锁定</label>
</td>
</tr>
</table></td></FORM>
<script>
function chk(flag)
{
with(document.getElementById("frm"))
{
for(var i=0;i<elements.length;i++)
{
elements[i].disabled=flag;
}
}
}
</script>
<input type="checkbox" onclick="chk(!this.checked)">
<body onload="chk(true)">
<table id="tblFrm" width="80%" height="125" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr><FORM name="admin" id="frm" method="post" action="xitongok.php">
<td height="125" ><table width="87%" height="73" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="44%" height="24" align="right" >IP地址:</td>
<td width="56%" align="left" ><input name="ip" type="text" id="ip" value="<?php echo $ip?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td width="44%" height="24" align="right" >子网掩码:</td>
<td width="56%" align="left" ><input name="netmask" type="text" id="netmask" value="<?php echo $netmask?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td width="44%" height="24" align="right" >默认网关:</td>
<td width="56%" align="left" ><input name="gateway" type="text" id="gateway" value="<?php echo $gateway?>" onBlur="check_ip(this.value)"/></td>
</tr>
<tr>
<td height="24" align="right" >服务器别名:</td>
<td align="left" ><input name="servername" type="text" id="servername" value="<?php echo $servername;?>" /></td>
</tr>
</table>
<table width="87%" height="24" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="25" align="center" ><input name="tijiao" type="submit" class="btn" border="0" value="确 定">
</td>
</tr>
</table></td></FORM>
</body>
如果form元素多的话,考虑效率可以用一个层遮住FORM