用户提交表单时先判断是否为空(数组文本框) for(var i=0;i<...){document.getElementById("add"+i).value}是这个意思不? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 document.form.add[i].value.length== 0 or document.form.add[i].value.length <1or document.form.add[i].value == "" "add <%=i%>"这个不能有空格吧,用下划线试一下 <script type="text/javascript"> function beforeSubmit(form){ for (i=1 to <%=Session("count")%> ){ if(document.getElementById("add"+i).value == ''){ /*疑点*/ alert('title not empty!'); document.form.add[i-1].focus(); return false; } } for (i=1 to <%=Session("count")%> ){ if(document.getElementById("content"+i).value == ''){ /*疑点*/ alert(content not empty!'); document.form.content[i-1].focus(); return false; } }} </script> <form id="form" name="form1" method="get" action="insert.asp" onSubmit="return beforeSubmit(this);"> <%for i=1 to count %> <div> 标题: <input type="text" name="add <%=i%>" id="add <%=i%>"/> 内容: <input type="text" name="content <%=i%>" id="content <%=i%>"/> </div> <%next %> <input type="submit" value="提交"/> </form> 怎么判断页面是否第一次打开还是刷新 openflashchart 在ie6报错请教。 javascrpt读取p标签内的动态input javascript位运算的问题 怎样从特定网页的特定位置截取数据? HTC小问题 javascript:如何截掉一个字符串头尾的空格? 我怎样才能将值付给<input type="file" name="dd">的文本框? 请问怎么将一个字符串强制转换成对象啊???? 师傅,快来看呀。。快来帮忙~~ 斗胆献丑,发一个自己写的web excel 我的电脑开机后总是 要点击两次任务管理器
or
document.form.add[i].value.length <1
or
document.form.add[i].value == ""
这个不能有空格吧,用下划线试一下
function beforeSubmit(form){
for (i=1 to <%=Session("count")%> ){
if(document.getElementById("add"+i).value == ''){ /*疑点*/
alert('title not empty!');
document.form.add[i-1].focus();
return false;
}
}
for (i=1 to <%=Session("count")%> ){
if(document.getElementById("content"+i).value == ''){ /*疑点*/
alert(content not empty!');
document.form.content[i-1].focus();
return false;
}
}}
</script>
<form id="form" name="form1" method="get" action="insert.asp" onSubmit="return beforeSubmit(this);">
<%for i=1 to count %>
<div>
标题: <input type="text" name="add <%=i%>" id="add <%=i%>"/>
内容: <input type="text" name="content <%=i%>" id="content <%=i%>"/>
</div>
<%next %>
<input type="submit" value="提交"/>
</form>