jq实现跳转404跳转,原生js实现跳转404跳转
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
//jq實(shí)現(xiàn)跳轉(zhuǎn)404跳轉(zhuǎn)
? ? <script>?
? ? function timeGo() { ?
? ? ? ? var sec = $(".countd-down p span").text(); ?
? ? ? ? $(".countd-down p span").text(--sec); ? ? //text()設(shè)置或返回被選元素的文本內(nèi)容。 ?
? ? ? ? if (sec > 0) ?
? ? ? ? ? ? setTimeout("timeGo();", 1000); ?//在一秒之后執(zhí)行G0()這函數(shù)}); ?
? ? ? ? else ?
? ? ? ? ? ? window.location.href = "index.html"; ?
? ? } ?
?? ?timeGo();//執(zhí)行函數(shù)
</script>
? ? //原生js實(shí)現(xiàn)404跳轉(zhuǎn)
? ? //設(shè)定倒數(shù)秒數(shù)
?? ?var t = 5;
?? ?//顯示倒數(shù)秒數(shù)
?? ?function showTime(){
?? ? ? ?t -= 1;
?? ? ? ?document.getElementById('numError').innerHTML= t;
?? ? ? ?if(t==0){
?? ? ? ? ? ?location.href='index.html';
?? ? ? ?}
?? ? ? ?//每秒執(zhí)行一次,showTime()
?? ? ? ?setTimeout("showTime()",1000);
?? ?}
?? ?showTime();
? ? //定義和用法
? ? //setInterval() 方法可按照指定的周期(以毫秒計(jì))來調(diào)用函數(shù)或計(jì)算表達(dá)式。
? ? //setInterval() 方法會(huì)不停地調(diào)用函數(shù),直到 clearInterval() 被調(diào)用或窗口被關(guān)閉。由 setInterval() 返回的 ID 值可用作 clearInterval() 方法的參數(shù)。
? ? //提示: 1000 毫秒= 1 秒。
轉(zhuǎn)載于:https://my.oschina.net/parchments/blog/808539
總結(jié)
以上是生活随笔為你收集整理的jq实现跳转404跳转,原生js实现跳转404跳转的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: openssl C函数总结,
- 下一篇: java json格式的转换和读取