如何弹出对话框

来源:百度知道 编辑:UC知道 时间:2024/05/24 10:34:25
添加记录时,
如果某textfield为空,
提交时则弹出对话框: "textfield不能为空",
确定后返回刚才的页面.
请问怎样做呀?

(暂时没分,等有分了,采纳时再加.)

1.在客户端检测
<script>
function checktextfield(fm) {
if (fm.textfield.value == '') {
alert('textfield不能为空');
fm.textfield.focus();
return false;
}
return true
}
</script>
<form onsubmit="return(checktextfield(this))">
<input name=textfield>
</form>

2.在服务端检测:
<%
textfield = trim(request("textfield"))
if textfield = "" then
response.write "<script>alert('textfield不能为空');history.back();</script>"
response.end
end if
%>

if textfield="" then
msgbox "textfield不能为空"
end if