OK!
给你写了一段~~~
----------------------------------
在页面1,添加一个按钮
按钮让页面转向到另外一页:
----------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Redirect("WebForm4.aspx?interval=8")
End Sub
-----------------------------------
在WebForm4页面取得interval这个参数,作为执行函数的时间间隔
并且在WebForm4上放一个按钮,代码如下:
-----------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strinterval = Request("interval")
Dim strscript As String = "<script language='javascript'>function execbytime(){window.setTimeout('execbytime()'," & strinterval * 1000 & ");alert('a test!');}</script>"
If Not IsClientScriptBlockRegistered("clientscript") Then
Page.RegisterClientScriptBlock("clientscript", strscript)
End If
Button1.Attributes.Add("onclick", "execbytime();return false;")
End Sub
-------------------------------------
运行此页面,函数每隔8秒运行一次,弹出一个提示框