通用--定时跳转(Javascript结合Asp.net)

news/2024/7/8 4:19:00

本例目的为制作一个通用的定时跳转页面,当程序需要进行页面跳转的时候,只需要Response.Redirect("jumpPage.aspx?url=xxxxx&Message=xxxxx")就可以用了。

jumpPage.aspx
1 <span id="s">用来显示提示信息<Span id="d">用来显示,N秒后跳转
2 var u=<%= murl%>;用来提取后台Request得到的值。由传递过来的页面参数得来。
--------------------------------------------------------------------------------
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="jumpPage.aspx.vb" Inherits="Mydesk_Base_jumpPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
     </head><body>
<form id="form1" runat="server">
<br />
<span id="s" ></span>
<br /><br />
<span id="d"></span> 
 </form>
<SCRIPT LANGUAGE="JavaScript">
var time = 4; 
var u=<%= murl%>;
var m=<%= mes%>;
document.all.s.innerHTML= m;
document.all.d.innerHTML= "---"+(time)+"秒后 将跳转到相关页面---"
function Redirect(){
    window.location=u;
    }
var i = 1;
function dis(){
  document.all.d.innerHTML= "---"+(time-i)+"秒后 将跳转到相关页面---"
  i++;
  }
timer=setTimeout('Redirect()',time * 1000);
timer=setInterval('dis()', 1000);
</SCRIPT>
</body>
</html>

jumpPage.aspx.vb
注:
1 mes为显示信息,murl为n秒后跳转到页的地址
2 mes和murl必须在Sub外定义成Public。否则在javascript找不到。

--------------------------------------------------------------------------------
Partial Class Mydesk_Base_jumpPage
    Inherits System.Web.UI.Page
    Public mes As String
    Public murl As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        mes = Request.QueryString("Message")
        murl = Request.QueryString("url")
    End Sub
End Class

 

引用示例:
------------------------------------------------------------------------------
            If MailBoxCount> 0 Then
               ...
            Else
                Response.Redirect("JumpPage.aspx?url='NewAccount.aspx'&Message='没有配置新邮箱,请配置之后使用'", False)
            End If

 


http://www.niftyadmin.cn/n/3970899.html

相关文章

大背景

html如下&#xff1a; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns"http://www.w3.org/1999/xhtml"><head><meta http-equ…

利用System.Drawing画线状图,柱状图和饼图.

以前实现图表的时候,采用的是OWC,方法如下: OWC11下载网址http://www.microsoft.com/downloads/details.aspx?familyid7287252C-402E-4F72-97A5-E0FD290D4B76&displaylangzh-cn使用教程http://blog.csdn.net/Eray/archive/2007/03/20/1534509.aspx 如果对图表要求较复杂…

css div圆角代码

-moz-border-radius:20px; -webkit-border-radius:20px; border-radius:20px;

关于treeview控件复选框

js吧。。给你代码。我实现了的。。没什么问题。记得在Page_load时间写 this.TreeView1.Attributes.Add("onclick", "CheckEvent()"); JScript code //获取元素指定tagName的父元素 function public_GetParentByTagName(element, tagName) { var paren…

推荐几个比较好用的GTD工具

前几天听米老师讲了关于时间管理的课&#xff0c;其中提到了GTD&#xff08;Getting Things Done&#xff09;。GTD是一种比较先进和有效的时间管理理论&#xff0c;我们可以用这种理论来提高我们学习效率&#xff0c;使我们在面对众多的待完成任务时&#xff0c;有条不紊。 我…

对象不能从DBNull 转换为其他类型的解决方法

string sql_str"select MAX(lID) from liuyan":改成 语句string sql_str "select iif((MAX(lID)) is null,0,1) from liuyan"; iff(判断&#xff0c;是&#xff0c;否) 但是只能添加一次&#xff0c;因为第二次添加运行string sql_str "select i…

如何在Eclipse中添加tomcat服务器

在J2EE开发中&#xff0c;时不时的要在编程过程中预览自己所做的开发&#xff0c;如果每次都将工程发布到TOMCAT来预览这样很麻烦&#xff0c;于是我们需要将tomcat添加到Eclipse中以便随时启动预览工程项目。 这里我们说下如何在Eclipse中添加Tomcat服务器。 配置完成后&#…

.net20做网站过程

1&#xff0c;根据需求ps出网站模板&#xff0c;切割图片。 - 2&#xff0c;保存到dw中&#xff0c;画层。 - 3&#xff0c;到vs中&#xff0c;建母版页&#xff0c;在层里放入ContentPlaceHolder&#xff0c;创建内容页。 - 4&#xff0c;所有编辑代码在内容页ContentPlace…