点击按钮刷新页面 [英] Refreshing page on click of a button
本文介绍了点击按钮刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在点击按钮时刷新当前页面。
I would like to refresh the current page when a button is clicked.
使用JavaScript,我有以下内容:
Using JavaScript, I have the following:
<button type="button" onClick="refreshPage()">Close</button>
<script>
function refreshPage() {
// What do I put here?
}
</script>
刷新当前页面的代码是什么样的?
What would to code look like to refresh the current page?
推荐答案
<button type="button" onClick="refreshPage()">Close</button>
<script>
function refreshPage(){
window.location.reload();
}
</script>
或
<button type="button" onClick="window.location.reload();">Close</button>
这篇关于点击按钮刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文