其他分享
首页 > 其他分享> > JS_0003:js刷新页面 关闭页面

JS_0003:js刷新页面 关闭页面

作者:互联网

页面自动刷新js版

<script language="JavaScript">
function myrefresh()
{
       window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
如果想关闭窗口时刷新或者想开窗时刷新的话,在<body>中调用以下语句即可。

<body οnlοad="opener.location.reload()"> 开窗时刷新
<body onUnload="opener.location.reload()"> 关闭时刷新

<script language="javascript">
window.opener.document.location.reload()
</script>
1.页面自动刷新:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20">
其中20指每隔20秒刷新一次页面.

2.页面自动跳转:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20;url=//www.jb51.net">
其中20指隔20秒后跳转到//www.jb51.net页面

 

标签:20,0003,跳转,js,window,location,刷新,页面
来源: https://www.cnblogs.com/eliteboy/p/12878501.html