4.5每日总结

发布时间 2023-05-05 21:59:04作者: 漏网鲨鱼

今天学习了HTML页面的刷新。

<a href="javascript:location.reload();">点击重新载入页面</a>

<a href="javascript:history.go(0);">点击重新载入页面</a>

<a href="javascript:location=location;">点击重新载入页面</a>

<a href="javascript:location=location.href;">点击重新载入页面</a>

<a href="javascript:location.replace(location);">点击重新载入页面</a>

<a href="javascript:location.replace(location.href);">点击重新载入页面</a>

<a href="javascript:location.assign(location);">点击重新载入页面</a>

<a href="javascript:location.assign(location.href);">点击重新载入页面</a>

 

 

<a href="javascript:document.URL=location.href;">点击重新载入页面</a>

<a href="javascript:navigate(location);">点击重新载入页面</a>

<a href="javascript:document.execCommand('Refresh');">点击重新载入页面</a>

<script>

function reloadPage(){

window.location.reload();

}

</script>

<input type="button" value="重新加载页面" οnclick="reloadPage()" />

 

 

<a href="">点击重新载入页面</a>

<a href="页面本身">点击重新载入页面</a>

三、实现html页面自动刷新

1. 页面自动刷新:

<meta http-equiv="refresh" content="10">

注:content="10"其中的数字表示刷新间隔的秒数

2.跳转到指定页面:

<meta http-equiv="refresh" content="10;url=你的网站地址">

3.页面自动刷新js版:

<script language="JavaScript">script">

setTimeout(function(){location.reload()},1000); //指定1秒刷新一次

</script>