利用 IFrame 提交表单后回到本页

来源:互联网 发布:vga视频矩阵切换器调试 编辑:程序博客网 时间:2024/05/29 18:02

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
  <form name="form1" method="post" action="" onSubmit="return check()" target="Hide">
  <table width="95%"  border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="27%" height="25" align="center">姓名:</td>
      <td width="73%"><input type="text" name="username"></td>
    </tr>
    <tr>
      <td height="25" align="center">Email:</td>
      <td><input type="text" name="mail"></td>
    </tr>
    <tr>
      <td height="25" align="center">电话:</td>
      <td><input type="text" name="phone"></td>
    </tr>
    <tr>
      <td height="25" align="center">留言:</td>
      <td align="center"><textarea name="content" cols="20" rows="5"></textarea></td>
    </tr>
    <tr>
      <td height="25" colspan="2" align="center"><input type="submit" name="Submit" value="提交">
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="reset" name="Submit2" value="重置"></td>
    </tr>
  </table>
</form><%
   if request("username")<>"" then
   set rs=server.CreateObject("adodb.recordset")
   sql="select * from message where id is null"
   rs.open sql,conn,1,3
   rs.addnew
   rs("username")=request("username")
   rs("mail")=request("mail")
   rs("phone")=request("phone")
   rs("content")=request("content")
   rs.update
   if err.number<>0 then
   err.clear
   response.Write("<script>alert('您填写的信息提交失败');window.parent.window.location.reload();</script>")
   else
   response.Write("<script>alert('您填写的信息提交成功');window.parent.window.location.reload();</script>")
   end if
end if
%>
<script>

<iframe name="Hide" style="display:none "></iframe>


</body>
</html> 

 或者还可以利用

location.href(request.serverViarable("http_referer"))

可以回到本页

原创粉丝点击