setTimeout()与setInterval()在此案例的区别?
var sec = document.getElementById("second"); //1:为什么这儿不用.value?
var i = 5; //2:为什么此处不能使用setTimeout()?
var timer = setInterval( function () {
i --;
sec.innerHTML = i; //3:页面中显示秒数.innerHTML什么意思?
if (i == 1) {
window.location.href = "http://www.google.com/";
}
}, 1000 );
//通过window的location和history对象来控制网页的跳转。
function goBack() {
window.history.go(-1);
} 问题:
1:为什么这儿不用 document.getElementById("second").value?
2:为什么此处不能使用setTimeout()?
3:页面中显示秒数.innerHTML什么意思?