弹出错误,怎么做?

yes2000 2003-05-19 10:13:05
执行一个操作时,如果错误,用一个新页面弹出一个错误窗口,我觉得这样会有很我麻烦,比如说用MYIE。
那种在窗口上方只弹出一个错误或是一警告,然后点击“确定”就可以,是怎么做的?
...全文
28 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
yes2000 2003-05-20
  • 打赏
  • 举报
回复
possible_Y的短信回答:
动态的生成客户端的函数啊
<%
……'连接数据库
set rs=conn.Execute(sql)
%>
<script language=javascript>
function check(f1) {
if(f1.t1.value == "" ¦ ¦ f1.t2.value="") {
alert("不能有空!");
return false;
}
if(f1.t1.value !="<%=rs("num")%>") {
alert("不能有空!");
return false;
}
return true;
}
</script>
<form onsubmit="return check(this)" method="POST" action="domainseek.asp">
<input type="text" name="t1">
<input type="text" name="t2">
<input type="submit">
</form>

总之有一点,要分清客户端和服务器端的区别,在客户端无法执行服务器上数据库操作,只有提交到服务器(也就是触发服务器端程序)上才能执行服务器上数据库操作
yes2000 2003-05-20
  • 打赏
  • 举报
回复
我原来用的是VBscript写的程序,怎么办?
yes2000 2003-05-20
  • 打赏
  • 举报
回复
possible_Y的短信回答:
<script language=javascript>
function check(f1) {
if(f1.t1.value == "" | | f1.t2.value="") {
alert("不能有空!");
return false;
}
return true;
}
</script>
<form onsubmit="return check(this)" method="POST" action="2.asp">
<input type="text" name="t1">
<input type="text" name="t2">
<input type="submit">
</form>

我在判断中会用到很多读书数据库的操作,怎么做?
bhys 2003-05-20
  • 打赏
  • 举报
回复
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
function MM_popupMsg(msg) { //v1.0
alert(msg);
}
//-->
</script>
</head>
<%if 出错为真 then %>
<body bgcolor="#FFFFFF" text="#000000" onLoad="MM_popupMsg('错误提示信息!')">
</body>
<%end if%>
</html>
  • 打赏
  • 举报
回复
好象不可能,alert()、prompt()、confirm()、msg等都是函数,你不用Function也要用脚本内部函数,Sub实际也是Function
yes2000 2003-05-19
  • 打赏
  • 举报
回复
能不能有不用写函数?
杨小杨 2003-05-19
  • 打赏
  • 举报
回复
给你一个例子!

<script language=javascript1.2>
function submitchecken() {

if (document.frmsearchInt.Domain.value == "") {
alert("请输入您要查询的英文域名。");
document.frmsearchInt.Domain.focus();
return false;
}
return true;
}
</script>
<form name=frmsearchInt method="POST" action="domainseek.asp">

<TABLE width=330 height=120 border=0 cellPadding=0 cellSpacing=0>
<TR>
<TD height=37
colSpan=3 ><div align="center">英文国际国内域名查询:<FONT size=2><B><FONT
face=Arial>www. </FONT></B></FONT>
<INPUT name=Domain size=17 class="inputbox">
<INPUT name="Submit" height=15 onclick="return submitchecken();" value="提交" type=submit >
</div></TD>
</TR>
</TABLE>
</FORM>
杨小杨 2003-05-19
  • 打赏
  • 举报
回复
提交时检查数据合理性,用一函数即可。可以在网上随便找一个有表单提交的网页看看源代码你就会明白的!
yes2000 2003-05-19
  • 打赏
  • 举报
回复
我用表单提交到另一个表时,如果错误,会联接到那个地址。
能不能这样:如果输入错误,第一个页面不动,只会弹出一个错误提示,这样就可以对已输入的进行修改。
windowsDNA 2003-05-19
  • 打赏
  • 举报
回复
alert();prompt() confirm()
possible_Y 2003-05-19
  • 打赏
  • 举报
回复
<%if 出错为真 then %>

<script>
alert("错误")
</script>

<%else%>

……

<%end if%>
possible_Y 2003-05-19
  • 打赏
  • 举报
回复
<script>
alert("错误")
</script>

<script language="vbscript">
msgbox("错误")
</script>


28,408

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧