頁面刷新類型:
1、window.location.reload 刷新。
window.location.reload()與window.location.href=window.location.href都可以刷新頁面。
注:
window.location.reload()刷新頁面時,頁面若有數據提交會提示是否提交數據,就是我們經常看到的那個討厭的提示框。window.location.href=window.location.href則不會。
2、frame框架刷新。
代碼如下:
<html>
<head>
<title> 右邊框 </title>
<script type="text/javascript">
function doResh(){
window.parent.frames["leftfr"].location = "http://www.baidu.com";
}
</script>
</head>
<body>
<b>右邊框</b>
<input type="button" onClick="doResh();" value="刷新"/>
</body>
</html>
記住:
window.location.href的要點,window, parent,opener。