<script>
function checkform()
dim errflag, msg
errflag = True
If len(trim(theForm.text1.value))= 0 then
msg = "不能为空"
MsgBox msg, 64, "警告!"
focusto(0)
errflag = false
Exit Function
End if
checkform = errflag
theForm.Submit
End Function
sub focusto(x)
document.theForm.elements(x).focus()
end sub
</script>
<form name=theform>
<input type=text name=txt1>
<input type=button name=ok value=submit>
</form>