标题:错在哪里了?!
取消只看楼主
tody
Rank: 1
等 级:新手上路
威 望:2
帖 子:119
专家分:0
注 册:2005-11-17
 问题点数:0 回复次数:1 
错在哪里了?!

如题,请帮忙指教
<html>
<head>
<script language = "javascript">
<!--
function go(o,n){
if(o.value.length >= 3 && n != null)
document.myForm.elements[n].focus();
doValidate();
}
function doValidate(){
var isValid = true;
for(var i = 0;i < document.myForm.length;i++){
var items = document.myForm.elements[i];
if(items.value.length == 0){
isValid = false;
break;
}
}
if(isValid){
document.myForm.submit.disabled = false;
}
}
//-->
</script>
</head>
<body>
<form name = "myForm">
<input type = "text" name = "text1" size = "3" onkeyup = "go(this,1)">
<input type = "text" name = "text2" size = "3" onkeyup = "go(this,2)">
<input type = "text" name = "text3" size = "3" onkeyup = "go(this)">
<input type = "submit" value = "submit" disabled>
</form>
</body>
</html>

搜索更多相关主题的帖子: javascript html function false null 
2005-11-18 15:07
tody
Rank: 1
等 级:新手上路
威 望:2
帖 子:119
专家分:0
注 册:2005-11-17
得分:0 

解决了!
<html>
<head>
<script language = "javascript">
<!--
function go(o,n){
if(o.value.length >= 3 && n != null){
document.myForm.elements[n].focus();
doValidate();
}
}
function doValidate(){
var isValid = true;
for(var i = 0;i < document.myForm.length - 1;i++){
var items = document.myForm.elements[i];
if(items.value.length == 0){
isValid = false;
break;
}
}
if(isValid)
document.myForm.submit.disabled = false;
}
//-->
</script>
</head>
<body>
<form name = "myForm">
<input type = "text" name = "text1" size = "3" onkeyup = "go(this,1)">
<input type = "text" name = "text2" size = "3" onkeyup = "go(this,2)">
<input type = "text" name = "text3" size = "3" onkeyup = "go(this,0)">
<input type = "submit" value = "submit" name = "submit" disabled>
</form>
</body>
</html>


记录就是用来破的, 自尊就是用来伤的。
2005-11-18 15:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-34038-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.383783 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved