判断是否为空

来源:百度知道 编辑:UC知道 时间:2024/05/14 18:41:58
<script language="vbscript">
function checkform()
dim msg
if len(trim(theForm.title.value))=0 then
msg=MsgBox("error",48,"err")
msg.show()
theForm.title.focus()
checkform=false
Exit Function
end if
theForm.submit
end function
</script>
<form id="theForm" name="theForm" method="post" action="message_main.asp" >
<input type="submit" name="Submit" value="提交" onclick=checkForm()>
<input type="reset" name="Submit2" value="重置" /></td>
</form>

虽然是有个对话框弹出,但是它还是会提交,我想要的是弹出对话框确定后,不提交!应该怎么弄!
是不是在BUTTON 里的ONCLICK??

<script language="vbscript">
function checkform()
dim msg
if len(trim(theForm.title.value))=0 then
msg=MsgBox("error",48,"err")<

因为<input type="submit" name="Submit" value="提交" onclick=checkForm()>
属性是submit,只要点击就会执行提交表单,你换成button就可以了,函数checkForm()里面已经写theForm.submit
还有注意一些小的语法错误。
完毕!