自己写吧
<script>
function CheckForm()
{
for(iIndex=0;iIndex<document.forms[0].elements.length;iIndex++)
{
if(document.forms[0].item(iIndex).tagName=="INPUT")
{
if(document.forms[0].item(iIndex).type=="text")
{
if(document.forms[0].item(iIndex).value=="")
{
return false;
}
}
}
}
return true;
}
</script>
<form>
<input type=text id="T1" value="">
<input type=text id="T2" value="">
<input type=text id="T3" value="">
<br>
<input type=button id="B1" value="效验" onclick="if(!CheckForm()){window.confirm('存在NULL')}">
</form>
<script>
function CheckForm()
{
for(iIndex=0;iIndex<document.forms[0].elements.length;iIndex++)
{
if(document.forms[0].item(iIndex).tagName=="INPUT")
{
if(document.forms[0].item(iIndex).type=="text")
{
if(document.forms[0].item(iIndex).value=="")
{
return false;
}
}
}
}
return true;
}
</script>
<form>
<input type=text id="T1" value="">
<input type=text id="T2" value="">
<input type=text id="T3" value="">
<br>
<input type=button id="B1" value="效验" onclick="if(!CheckForm()){window.confirm('存在NULL')}">
</form>
onSubmit="MM_validateForm('c1','','R','c2','','R');return document.MM_returnValue"
这一段分号后面的返回值起什么作用?
另附上一个前段程序中调用了的函数,
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}