关于表单提交的问题!
<html>
...htm文本...
</head>
<script language=vbscript>
<!--
...其他VBscript程序...
sub company
newname=rtrim(trim(formcompany.newcompany.value))
if newname="" or isnumeric(newname)=True or len(newname)<2 then
msgbox "新单位名称不符合要求,请重新填写!",48,"单位名称不能为空或者为数字或少于两个字符!"
formcompany.newcompany.focus
else
formcompany.submit
end if
end sub
...其他VBscript程序...
-->
</script>
...htm文本...
<input type="input" name="newcompany" size=15>
<input type="button" value="确定" name="butt1" onclick=company language="vbscript">
<input type="button" value="取消" name="butt2">
...htm文本...
问题:
程序sub company是用来检测newcompany内输入的值是否符合要求,再确定是否提交表单。
通过点击“确定”按钮确实能实现此目的。可是我发现当焦点没在“确定”按钮上时按
回车键也能直接提交表单(那样自然没有运行newcompany检测程序)。
请问高手:有什么办法能使文件取消这一直接提交表单的功能,必须通过点击“确定”
按钮才能提交呢?请高手指导,满意必给分!!!