不要用txt1,txt2了,。。都用同一个名txt,你的代码对了
解决方案 »
- 在IE 6 7 8 9 下输出option 显示不正常的原因?
- JavaScript table 问题
- Ext js designer javascript 懂的都进来看看啊
- 判断DIV是否显示问题
- 为何ext的grid显示的表格里没数据呢?
- 如何给对象添加自定义事件?急
- window.opener.document为什么提取不到父窗口数据?
- 请教: 我觉得我这段代码是无错的,为什么老是报错?
- window.open 的一个特殊要求。在线等!
- 如何在模式对话框中引用父窗口?
- 该怎么写啊?各位大哥近来看看吧!
- [群12634167]开发人员关于C#、VB和VBScrip的技术群(群内气氛较为活跃,喜静者勿加)
<!--
function chehkForm(form)
{
alert(form.elements[0].value);
for(var i=0; i < 3; i++)
{
if(form.elements[i].value == "")
{
alert(form.elements[i].name + " 不能为空!");
return false;
}
}
}
//-->
</script>
<form method=post action="" onsubmit="chehkForm(this)">
<table align=center width="100%" cellspacing=0 cellpadding=0 border=0 >
<tr>
<td height="200" align="center" bgcolor="#EEEEEE">
<input type="text" name="t1"><input type="text" name="t2"><input type="text" name="t3">
<br><input type="submit">
</td>
</tr>
</table>
</form>
{
for (var i=1;i<11;i++){
if (eval("form.txt"+i+".value==''"))
{
alert('txt'+ i + "数值为空,请确认')
return false;
}
}
}