在頁面中加入js代碼
<script type="text/javascript">
function a(){
setTimeout(b()',10*1000); //時間間隔為毫秒,此處為10秒執行一次
}
function b(){
var url = "xxxx";//發送請求的url地址
window.location.href = url;
//或者用window.locatoin.reload();
}
</script>
② 網頁刷新代碼怎麼用
在網頁 A 中最後面加上代碼:
<iframe width="0" height="0" src="B.htm" name="網頁B"></iframe>
在網頁 B 中<head>與</head>之間加上:
<meta http-equiv="refresh" content="8">
content="8" 表示 8 秒刷新一次!~
上面假設了 網頁 B 為:B.htm
③ 每隔多少秒刷新網頁的代碼急
XMLHTTP我使用了確實存在這樣的問題,在進程沒結束前結果永遠不變
不過我找到了解決方案,我沒你那麼快,我是5分鍾,5分鍾舊的程序自動退出前啟動一個新的進程,這樣就可以刷新了,我已經使用了三個多月,只要計算機開著都實時刷新,處理代碼,效果非常理想,望採納,謝謝!
以下是VBS代碼:
========edit1.vbs=========
Dim s, t, fso, w
Set w = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
s = GetCode("GB2312", "")
's是代碼,在這里處理
wscript.sleep 5000
w.run "wscript.exe """ & wscript.scriptfullname & """"
Public Function BytesToBstr(strBody, CodeBase)
Dim ObjStream
Set ObjStream = CreateObject("Adodb.Stream")
With ObjStream
.Type = 1
.Mode = 3
.open
.write strBody
.Position = 0
.Type = 2
.Charset = CodeBase
BytesToBstr = .ReadText
.Close
End With
Set ObjStream = Nothing
End Function
Public Function GetCode(CodeBase, Url)
Dim xmlHTTP1
Set xmlHTTP1 = CreateObject("Microsoft.XMLHTTP")
xmlHTTP1.open "get", Url, True
xmlHTTP1.send
While xmlHTTP1.readyState <> 4
wscript.sleep 100
Wend
GetCode = xmlHTTP1.responseBody
If CStr(GetCode) <> "" Then GetCode = BytesToBstr(GetCode, CodeBase)
Set ObjXML = Nothing
End Function
④ 網頁延時3秒刷新頁面 的代碼是多少
兩種方法:
1.在<head><head>里加入以下代碼(間隔5秒刷新網頁):
<meta http-equiv="Refresh" content="5">
2.用js腳本實現(間隔5秒刷新網頁):
function refreshPage()
{
window.location.reload();
window.setTimeout("refreshPage()",5000);
}
refreshPage();
補充:
function refreshPage()
{
window.location.reload();
}
window.setTimeout("refreshPage()",3000);
⑤ 幫忙做個自動刷新網頁的代碼。
使用webBrowser控制項。
Private Sub Command1_Click()
If InStr(1, WebBrowser1.LocationURL, "http://www.shishicai.cn/Lottery/Speed/FCCQSSC/Trend/bz3x_zs_dxjo.aspx", vbTextCompare) > 0 Then '請在此修改你要刷新的內部網頁的地址
WebBrowser1.Refresh '刷新
End If
End Sub
⑥ 關於網頁自動刷新代碼
如何讓頁面只復自動刷新制一次
記得<meta>標簽當中有一個refresh的功能嗎?這是讓瀏覽的頁面刷新並可以轉到相應的頁面,如果刷新本頁的話就會造成重復的刷新,現在我們就試試用腳本來實現只讓頁面刷新一次.
1.看看下面這段代碼
<Script>
function reurl(){
url = location.href; //把當前頁面的地址賦給變數 url
var times = url.split("?"); //分切變數 url 分隔符號為 "?"
if(times[1] != 1){ //如果?後的值不等於1表示沒有刷新
url += "?1"; //把變數 url 的值加入 ?1
self.location.replace(url); //刷新頁面
}
}
onload=reurl
</script>
2.原理
充分利用地址欄可帶參數的選項,用腳本來取得頁面間的傳遞參數,並不需要後台程序的支持。
⑦ 求代碼:能每五分鍾刷新的網頁代碼。。。急。。。
<script>
<!--
var limit="3:00"
if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" min "+cursec+" sec "
else
curtime=cursec+" sec "
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}
window.onload=beginrefresh
//-->
</script>
加到body中間,這里是3:00為三分鍾,可以自定
⑧ bat編程,刷新指定網頁 (求代碼)
On Error Resume Next
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://bbs.bathome.net"
IE.Visible = 1
'''''''Visible數值0隱藏,1新窗口'''''''
Wscript.Sleep 5000
Set O = IE.Document
Do While True
Wscript.Sleep 20000
O.Location.Reload(True)
If Err <> 0 Then
Wscript.Quit
End If
Loop
⑨ 網頁的刷新(F5)用html代碼寫是什麼
代碼如下:
<input type=button value=刷新 onclick="history.go(0)">
代碼如下:
<input type=button value=刷新 onclick="location.reload()">
代碼如下:
<input type=button value=刷新 onclick="location=location">
代碼如下:
<input type=button value=刷新 onclick="window.navigate(location)">
代碼如下:
<input type=button value=刷新 onclick="location.replace(location)">