jsp页面的前进刷新后退

转自:http://www.mikebai.com/Article/2009-11/757.html
  1. <input type=button value=刷新 onclick="window.location.reload()">  
  2. <input type=button value=前进 onclick="window.history.go(1)">  
  3. <input type=button value=后退 onclick="window.history.go(-1)">  
  4. <input type=button value=前进 onclick="window.history.forward()">  
  5. <input type=button value=后退 onclick="window.history.back()">  
<input type=button value=刷新 οnclick="window.location.reload()">
<input type=button value=前进 οnclick="window.history.go(1)">
<input type=button value=后退 οnclick="window.history.go(-1)">
<input type=button value=前进 οnclick="window.history.forward()">
<input type=button value=后退 οnclick="window.history.back()">
  1. 后退+刷新<input type=button value=后退 onclick="window.history.go(-1);window.location.reload()">  
后退+刷新<input type=button value=后退 οnclick="window.history.go(-1);window.location.reload()">
打开一个jsp页面,肯定是用客户端脚本进行刷新了。
Javascript刷新页面的几种方法:
  1. 打开一个jsp页面,肯定是用客户端脚本进行刷新了。  
  2. Javascript刷新页面的几种方法:  
  3. 1 history.go(0)  
  4. 2 location.reload()  
  5. location=location  
  6. 4 location.assign(location)  
  7. 5 document.execCommand('Refresh')  
  8. 6 window.navigate(location)  
  9. 7 location.replace(location)  
  10. document.URL=location.href  
打开一个jsp页面,肯定是用客户端脚本进行刷新了。
Javascript刷新页面的几种方法:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
如果是history.go(0)那就是刷新这两个属于JS代码,相当于IE的前进、后退功能。
具体的用处就要看什么时候需要这个就用上。比如用户注册时的验证是后台验证,不符合要求的时候就可以用这个,可以最大限度保证用户少重复输入数据。
  1. 例如:载入页面:  
  2.    function onLoadPage(){  
  3.      if(event.srcElement.tagName=="SPAN"){  
  4.          oFrame=top.window.middle.frames[2];  
  5.          oTxt=event.srcElement.innerText;  
  6.          switch(oTxt){  
  7.              case "前 进":  
  8.                  oFrame.history.go(1);  
  9.              case "后 退":  
  10.                  oFrame.history.back();  
  11.              case "刷 新":  
  12.                  oFrame.location.reload();  
  13.          }  
  14.      }  
  15. }  
例如:载入页面:
   function onLoadPage(){
     if(event.srcElement.tagName=="SPAN"){
         oFrame=top.window.middle.frames[2];
         oTxt=event.srcElement.innerText;
         switch(oTxt){
             case "前 进":
                 oFrame.history.go(1);
             case "后 退":
                 oFrame.history.back();
             case "刷 新":
                 oFrame.location.reload();
         }
     }
}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值