JavaScript basics
JavaScript refreshing web page syntax introduction
Sometimes when you are using a web page, you will inevitably encounter the need to press to refresh. If the page you give to netizens is opened through window.open() , maybe the browser does not have a refresh button option, you can use it at this time JavaScript syntax makes a rearranged button for netizens.
Basic grammar
window.location.reload("webpage path") Thepath of the webpage does not have to be written. If it is not written, it means that the current webpage is refreshed. Two ways to refresh the link button
<a href="javascript:window.location.reload()">Refresh</a>
<a href="#" onclick="javascript:window.location.reload()">Refresh</a>
The grammar of the second example uses the onclick state, which means that the refresh action is triggered when the left mouse button is pressed, but we think the first grammar is relatively simple and clear.
<a href="#" onclick="javascript:window.location.reload()">Refresh</a>
Post a Comment
0 Comments