よく使う何段のjavascriptコードは共有しますか?
1074 ワード
1.3秒後に自動的に
<span id="totalSecond">3</span>
<script language="javascript" type="text/javascript">
<!--
var second = document.getElementById('totalSecond').textContent;
if (navigator.appName.indexOf("Explorer") > -1) // IE Firefox ,
{
second = document.getElementById('totalSecond').innerText;
} else
{
second = document.getElementById('totalSecond').textContent;
}
setInterval("redirect()", 1000); // 1 redirect()
function redirect()
{
if (second < 0)
{
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>
に戻ります。