<script language=javascript>
<!--
function checkinput(form1)
{
var o=form1.all("name")
for(i=0;i<o.length;i++)
if(o[i].value.length>15)
{
alert("只能由15个字符组成!");
o[i].focus();
return false;
}
}
//-->
</script>
<form action=about:ok onsubmit="return checkinput(this)">
<input type="text" name="name" value="">
<input type="text" name="name" value="">
<input type=submit>
</form>
<!--
function checkinput(form1)
{
var o=form1.all("name")
for(i=0;i<o.length;i++)
if(o[i].value.length>15)
{
alert("只能由15个字符组成!");
o[i].focus();
return false;
}
}
//-->
</script>
<form action=about:ok onsubmit="return checkinput(this)">
<input type="text" name="name" value="">
<input type="text" name="name" value="">
<input type=submit>
</form>
<input type="text" name="name" maxlength="15" value="">
这样不是就不用判断了吗!!!
再说在表彰中你可以将它改不同名,再后台程序中你再将它放到其它的段中去呀
最方便
何必去判断呢
=>
var o=document.getElementsByName("name")