<script language=vbscript>
function checkinput()
if document.form2.xm.value="" then
alert " 请输入姓名!"
document.form2.xm.focus
window.event.returnValue=false
document.form2.add.click
end if
end function
</script>简单啦。呵呵,应该没有错吧?
function checkinput()
if document.form2.xm.value="" then
alert " 请输入姓名!"
document.form2.xm.focus
window.event.returnValue=false
document.form2.add.click
end if
end function
</script>简单啦。呵呵,应该没有错吧?
end sub
function checkinput()
if document.form2.xm.value = "" Then
msgbox "请输入姓名!"
document.form2.xm.focus()
checkinput = false
else
checkinput = true
document.form2.add.click()
window.event.returnValue=false
end if
end function
</script><form name=form2 onsubmit="return checkinput()">
<input type=text name=xm>
<input type=button name=add value=add onclick="vbscript:msgbox 'add is clicked'">
<input type=submit value=submit>
</form>
谁说没有alert函数?这个函数是DHTML中window对象的一个方法。默认情况下可以直接使用alert "xxxxx"来显示对话框的!不信你试试。