function lock(obj){
var inputs = document.admin.getElementsByTagName("input");
for(var i=0; i <inputs.length; i++){
if(inputs[i].type == "text" && inputs[i].name != "servername"){ inputs[i].disabled = (obj.value == 0);
}
}
}
window.onload = function(){
document.getElementById("chkLock").checked = true;
document.getElementById("chkLock").click();
}
这是小弟原来写的函数 可是用了上面的change()函数之后 这个函数不知道怎么用了
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>系统</title>
<script>
function change(flag){
var obj = document.getElementById("con");
var inputs = obj.getElementsByTagName("input");
if(flag){
for(var i=0;i<inputs.length;i++){
inputs[i].disabled = 'disabled';
}
}else{
for(var i=0;i<inputs.length;i++){
inputs[i].disabled = '';
}
}
}
function validate(nnn){
var result = true;
if(document.getElementById("dhcp2").checked){
var arr = nnn.split(".");
if(arr.length!=4){
result = false;
}
for(var i=0;i<arr.length;i++){
var val = arr[i];
var re = /^([1-9]\d*|0)$/;
if(val!=""){
if(!re.test(val)){
result = false;
}else{
var k = new Number(val);
if(k>255||k<0){
result = false;
}
}
}
}
}
return result;
}
function check(){
var result = true;
var ip = document.admin.ip.value;
result = result && validate(ip);
var mask = document.admin.netmask.value;
result = result && validate(mask);
var gateway = document.admin.gateway.value;
result = result && validate(gateway);
if(result){
return true;
}else{
alert("请正确填写");
return false;
}
}</script>
</head><body>
<FORM name="admin" method="post" action="xitongok.php" onsubmit="return check()"><div>
<input type="radio" name="dhcp" id="dhcp1" onClick="change(true)" checked>启用DHCP<input type="radio" id="dhcp2" name="dhcp" onClick="change(false)" checked>禁用DHCP
</div>
<div id="con">
IP地址:<input type="text" name="ip"/>
子网掩码:<input name="netmask" type="text"/>
默认网关:<input name="gateway" type="text"/>
</div>
服务器名:<input name="servername" type="text" id="servername" value="" />
<input type='submit' value="检查" >
</form>
</body>
</html> 这不是已经可以了么
----------------------------------------
找猎头把自己卖个好价钱!
原来不是已经可以了吗?
这句value="<?php $servername = iconv("utf-8",'gb2312',$servername); echo $servername;?>"
双引号中不能直接使用双引号,要改为单引号'utf-8'
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="tab.css" rel="stylesheet" type="text/css"></head>
<script language="javascript">
function switchTag(tag,content)
{
// alert(tag);
// alert(content);
for(i=1; i <4; i++)
{
if ("tag"+i==tag)
{
document.getElementById(tag).getElementsByTagName("a")[0].className="selectli"+i;
document.getElementById(tag).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="selectspan"+i;
}else{
document.getElementById("tag"+i).getElementsByTagName("a")[0].className="";
document.getElementById("tag"+i).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="";
}
if ("content"+i==content)
{
document.getElementById(content).className="";
}else{
document.getElementById("content"+i).className="hidecontent";
}
document.getElementById("content").className=content;
}
}
function init(){
lock(document.getElementById('chkLock'))
t=document.location.hash.replace('#','');
if(t=='')t=1;
switchTag('tag'+t,'content'+t);
}
function change(flag){
var obj = document.getElementById("con");
var inputs = obj.getElementsByTagName("input");
if(flag){
for(var i=0;i<inputs.length;i++){
inputs[i].disabled = 'disabled';
}
}else{
for(var i=0;i<inputs.length;i++){
inputs[i].disabled = '';
}
}
}
function validate(nnn){
var result = true;
if(document.getElementById("dhcp2").checked){
var arr = nnn.split(".");
if(arr.length!=4){
result = false;
}
for(var i=0;i<arr.length;i++){
var val = arr[i];
var re = /^([1-9]\d*|0)$/;
if(val!=""){
if(!re.test(val)){
result = false;
}else{
var k = new Number(val);
if(k>255||k<0){
result = false;
}
}
}
}
}
return result;
}
function check(){
var result = true;
var ip = document.admin.ip.value;
result = result && validate(ip);
var mask = document.admin.netmask.value;
result = result && validate(mask);
var gateway = document.admin.gateway.value;
result = result && validate(gateway);
if(result){
return true;
}else{
alert("请正确填写");
return false;
}
}</script>
<body onload="init()">
<table width="100%" height="207" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%"><fieldset>
<legend> 网络设置 </legend>
<table width="80%" height="125" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr><FORM name="admin" method="post" action="xitongok.php" onsubmit="return check()">
<td height="125" ><table width="87%" height="73" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<div>
<td height="24" align="right" > <input name="r1" type="radio" value="0" id="dhcp1" onClick="change(true)" checked>启用DHCP</td>
<td align="left" > <input name="r1" type="radio" value="1" id="dhcp2" onClick="change(false)" checked>不启用DHCP</td></div>
</tr>
<div id="con">
<tr>
<td width="44%" height="24" align="left" >IP地址:</td>
<td width="56%" align="left" ><input name="ip" type="text" id="ip" value="<?php echo $ip?>"/></td>
</tr>
<tr>
<td width="44%" height="24" align="left" >子网掩码:</td>
<td width="56%" align="left" ><input name="netmask" type="text" id="netmask" value="<?php echo $netmask?>"/></td>
</tr>
<tr>
<td width="44%" height="24" align="left" >默认网关:</td>
<td width="56%" align="left" ><input name="gateway" type="text" id="gateway" value="<?php echo $gateway?>"/></td>
</tr>
</div>
<tr>
<td height="24" align="left" >服务器别名:</td>
<td align="left" ><input name="servername" type="text" id="servername" value="<?php $servername = iconv("utf-8",'gb2312',$servername); 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>
</tr>
</table>
<br />
</fieldset></td>
</body>
</html>
是哪里出了毛病呀各位请帮忙弄下
----------------------------------------
找猎头把自己卖个好价钱!
应为tr,td并不是div里的合法标签,把<div id="con"></div>改为<table id="con"></table>就行。
顺便说一下,一般有两种格式化网页的方法,一种是在table中用tr,td,一种是div+css,没有用div+tr,td的。
你网站里根本没有,这些节点。 是不是没上传全啊 少的不是一点!!!!!!!!!!!
楼主怎么一个问题反复的问呀?
之前给你写的代码看了吗?