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