两个郁闷的问题!
<form name="form" action="/login/login/pro_sale.asp" method="post" onSubmit="return CheckForm(this)">
.........
<td width="218" align="center"><input type="image" src="../images/login_01.jpg" width="96" height="19" border="0" onclick="form.submit();"></td>
<td width="175" align="center"><input type="image" src="../images/login_02.jpg" width="96" height="19" border="0" onclick="form.reset();"></td>
</form>
<script language="javascript">
function isEmail(vEMail)
{
var regInvalid=/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
var regValid=/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
return (!regInvalid.test(vEMail)&®Valid.test(vEMail));
}
function CheckForm(theform)
{
if(theform.spmc.value=="")
{
alert("请输入商品名称!");
return false;
}
if(theform.spsm.value=="")
{
alert("商品数目是必填的信息!");
return false;
}
if(theform.szds.value=="")
{
alert("所在地(城市)是必填的信息!");
return false;
}
if(theform.spms.value=="")
{
alert("请输入商品描述!");
return false;
}
if(theform.lxr.value=="")
{
alert("请输入联系人!");
return false;
}
if (theform.dh.value=="")
{
alert("请输入电话号码!");
theform.dh.focus();
return false;
}
else
{
var Letters = "0123456789()+-";
for (i=0; i< theform.dh.value.length; i++)
{
var CheckChar = theform.dh.value.charAt(i);
if (Letters.indexOf(CheckChar) == -1)
{
alert("电话号码格式不正确!");
theform.dh.focus();
return false;
}
}
}
if(theform.dzyj.value=="")
{
alert("请输入E-Mail!");
theform.dzyj.focus();
return false;
}
else
{
if(!isEmail(theform.dzyj.value))
{
alert("请输入正确的E-Mail格式!");
return false;
theform.dzyj.focus();
}
}
return true;
}
</script>
我在提交页面的时候需要对页面检查,但是发现提交和重置怎么都条用了javascript中的函数?
还有pro_sale.asp是向数据库中插入数据,javascript中不允许唯恐,但是当存在空值的时候,一样讷能提交到数据库,为什么会这样,该如何解决?
问题点数:20、回复次数:7Top
1 楼firefox_1983(钱!钱!钱!)回复于 2006-03-04 15:57:19 得分 0
谁帮我看看?
Top
2 楼firefox_1983(钱!钱!钱!)回复于 2006-03-04 16:14:15 得分 0
难道就没有人知道?高手呢?Top
3 楼opolmzy(ASP)( 一寸木)回复于 2006-03-04 16:40:19 得分 0
太长了,看不下去Top
4 楼popcode(枫.net)回复于 2006-03-04 16:46:46 得分 0
检查你的js是否写得有问题Top
5 楼firefox_1983(钱!钱!钱!)回复于 2006-03-04 16:52:21 得分 0
js没有提示有错误Top
6 楼wangyingdong(初学asp.net)回复于 2006-03-04 16:54:54 得分 0
检查一下JS
没有从库之前,把值取出来,看看是什么!
Top
7 楼firefox_1983(钱!钱!钱!)回复于 2006-03-04 16:59:53 得分 0
这些都是正常的,希望当数据不完整的时候不能提交,问题就在这里,但我对js不熟悉Top




