我的网页在加载页面时运行 javascript 函数。但是,如果用户使用后退按钮返回此页面,我不希望该功能运行。如何使用 javascript 防止这种情况发生?
$(document).ready(function(){
// Do not run this function if the user has arrived here using the back button
RefreshThePage();
});
我的网页在加载页面时运行 javascript 函数。但是,如果用户使用后退按钮返回此页面,我不希望该功能运行。如何使用 javascript 防止这种情况发生?
$(document).ready(function(){
// Do not run this function if the user has arrived here using the back button
RefreshThePage();
});
我原以为使用 cookie 是最简单的方法
我认为研究 Struts 处理重复表单提交的方式可以帮助您。
一些链接:
http://www.techfaq360.com/tutorial/multiclick.jsp
事件对象为您提供获取密钥代码。所以基本上你注册了一个事件监听器 onKeyDown。使用接收到的事件。如果键码与您喜欢的键匹配,则继续您的功能。
document getElementById('elementId').onKeyDown = checkKey();
function checkKey(event) {
if (event.keyCode === keyCode) then . . .
}
玩弄 alert(event.keyCode); 找到合适的。