<script language="javascript" type="text/javascript"> var second = document.getElementById(‘totalSecond‘).textContent; setInterval("redirect()", 1000); function redirect() { document.getElementById(‘totalSecond‘).textContent = --second; if (second < 0) location.href = ‘02view.html‘; } </script>
4)解决Firefox不支持innerText的问题
<span id="totalSecond">5</span>
<script language="javascript" type="text/javascript"> if(navigator.appName.indexOf("Explorer") > -1){ document.getElementById(‘totalSecond‘).innerText = "my text innerText"; } else{ document.getElementById(‘totalSecond‘).textContent = "my text textContent"; } </script>
5)整合3)和3‘)
<span id="totalSecond">5</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; }