我想刷新按钮单击和页面刷新后调用一个函数的网页。 但它的相反情况不会发生,即先调用该函数,然后刷新页面。按钮点击后刷新页面,然后调用函数
这是我曾尝试:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
function restartall(){
$('#text').append('hello');
}
</script>
<a href="javascript:document.location.reload();">
<button onclick="restartall()">Referash Map</button></a>
<div id="text"></div>
请解决这个查询。
你为什么不使用AJAX来代替刷新页面? –
如果你使用jQuery,你为什么不用jQuery绑定事件,而是使用'onclick'参数等不安全的方法? – Wiktor
你能解释为什么你需要刷新页面吗? – Broxzier