window.onload = function(){
document.write("123");
var s = document.getElementById("btn1");
}
document.write引起页面重绘,所以id获取不到对象。
window.onload = function(){
document.write("123");
var s = document.getElementById("btn1");
}
document.write引起页面重绘,所以id获取不到对象。