单击时刷新页面的按钮 [英] Button that refreshes the page on click
本文介绍了单击时刷新页面的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个按钮,可以在用户点击时刷新页面.我试过这个:
I need a button that will refresh the page on the user's click. I tried this:
<input type="button" value="Reload Page" onClick="reload">
或
<input type="button" value="Refresh Page" onClick="refresh">
但都没有奏效.
推荐答案
Use onClick
with window.location.reload()
,即:
Use onClick
with window.location.reload()
, i.e. :
<button onClick="window.location.reload();">Refresh Page</button>
或history.go(0)
,即:
<button onClick="history.go(0);">Refresh Page</button>
或 window.location.href=window.location.href
用于full"重新加载,即:
Or window.location.href=window.location.href
for 'full' reload, i.e.:
<button onClick="window.location.href=window.location.href">Refresh Page</button>
这篇关于单击时刷新页面的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文