jsp 页面自动刷新

设置HTTP头信息
1>最有用的一个头信息:refresh 刷新
 response.setHeader("refresh","1");
2>跳转到另一页面,实现跳转功能
 response.setHeader("refresh","2;URL=Deom02.jsp");
(两秒钟后跳转到另一页面)


1. 页面自动刷新:把如下代码加入<head>区域
<meta http-equiv="refresh" content="20">
其中20指每隔20秒刷新一次页面.

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

3. 页面自动刷新js
<scriplanguage="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); // 指定1秒刷新一次
</script>

JS 刷新框架脚本<a href="http://sjolzy.cn/tag/%3Ca%20href=" http:="" sjolzy.cn="" tag="" 语"="" title="语" style="text-decoration: none; outline-width: 0px; outline-style: initial; outline-color: initial; color: rgb(102, 102, 102); ">语句" title="句" >句 // 如何刷新包含框架页面用   <scriplanguage=JavaScript> parent.location.reload(); </script>    // 子窗口刷新父窗口 <scriplanguage=JavaScript> self.opener.location.reload(); </script> (  或 <a href="javascript:opener.location.reload()">刷新</a>   ) // 如何刷新另一个框架页面用   <scriplanguage=JavaScript> parent.otherFrameID.location.reload(); </script> 如果想关闭窗口时刷新或者想开窗时刷新的话,在<body>中调用以下

<a href="http://sjolzy.cn/tag/%3Ca%20href=" http:="" sjolzy.cn="" tag="" 语"="" title="语" style="text-decoration: none; outline-width: 0px; outline-style: initial; outline-color: initial; color: rgb(102, 102, 102); ">语句" title="句" >句即可。 <body onload="opener.location.reload()"& gt; 开窗时刷新 <body onUnload="opener.location.reload()"& gt; 关闭时刷新 <scriplanguage="javascript"> window.opener.document.location.reload() </script>


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值