您的位置:首页 > Web前端 > JavaScript

JS捕获页面刷新,JS刷新父页面

2016-11-09 11:38 155 查看
JS刷新父页面

十一种刷新按钮的方法。很不错的,经常上网要找。哈哈。这下放这里了。  

<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="location.assign(location)">
<input type=button value=刷新 onclick="document.execCommand('Refresh')">
<input type=button value=刷新 onclick="window.navigate(location)">
<input type=button value=刷新 onclick="location.replace(location)">
<input type=button value=刷新 onclick="window.open('自身的文件','_self')">
<input type=button value=刷新 onClick=document.all.WebBrowser.ExecWB(22,1)> 
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
<form action="自身的文件">
<input type=submit value=刷新>
</form>
<a id=a1 href="自身的文件"></a>
<input type=button value=刷新 onclick="a1.click()">

JS捕获刷新

window.onbeforeunload = function()  
{      
       var n = window.event.screenX - window.screenLeft;      
       var b = n > document.documentElement.scrollWidth-20;      
       if(b && window.event.clientY < 0 || window.event.altKey)      
       {      
              alert("是关闭而非刷新");      
              window.event.returnValue = "";   
       }else  
       {      
              alert("是刷新而非关闭");       
       }      
}  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  JS 刷新 捕获