請問下,我想在頁面加載後,1 秒後讓頁面再自動重刷新一次,可是我用這個段代碼後卻變成了反覆刷新
setTimeout(function(){window.location.reload()},1000);
本來setTimeout不是應該只執行一次的麼?
setTimeout(function(){window.location.reload()},1000);
本來setTimeout不是應該只執行一次的麼?
也刷新了!所以又得执行了!
{
var regex_str = "^.+\\?.*?\\b"+ key +"=(.*?)(?:(?=&)|$|#)"
var regex = new RegExp(regex_str,"i");
var url = window.location.toString();
if(regex.test(url)) return RegExp.$1;
return undefined;
}var f = queryString("f");
if(!f)
{
window.setTimeout(function(){window.location=window.location.toString()+"?f=1"},1000)
}
adTimer=setTimeout(function(){window.location.reload();clearInterval(adTimer)},1000);
function onload() { function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
if (getQueryString('do') != 'true') {
setTimeout(function () { window.location.href = window.location + '?do=true'; }, 1000);
} };</script>