显示几秒内跳转
Posted hhls
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了显示几秒内跳转相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Untitled Document</title> </head> <body> <span id="totalSecond">2</span> <script language="javascript" type="text/javascript"> var second = document.getElementById(‘totalSecond‘).textContent; if (navigator.appName.indexOf("Explorer") > -1) { second = document.getElementById(‘totalSecond‘).innerText; } else { second = document.getElementById(‘totalSecond‘).textContent; } setInterval("redirect()", 1000); function redirect() { if (second < 1) { location.href = ‘http://www.baidu.com‘; } else { if (navigator.appName.indexOf("Explorer") > -1) { document.getElementById(‘totalSecond‘).innerText = second--; } else { document.getElementById(‘totalSecond‘).textContent = second--; } } } </script> </body> </html>
以上是关于显示几秒内跳转的主要内容,如果未能解决你的问题,请参考以下文章