日期:2014-05-16 浏览次数:20357 次
动态插入一个div
var objDiv = document.createElement("div");
?objDiv.innerHTML ="dsdsfsdsdsdds";
?objDiv.id?? =?? "asdf";??
? objDiv.style.position?? =?? "absolute";??
? objDiv.style.setAttribute("left","1px");??
? objDiv.style.setAttribute("top","1px");??
? objDiv.style.setAttribute("width",document.body.scrollWidth);??
? objDiv.style.setAttribute("height",document.body.clientHeight);??
? objDiv.style.setAttribute("border","1?? solid?? #000000");??
? objDiv.style.setAttribute("backgroundColor","#ff0000");
? objDiv.style.setAttribute("z-index","9999");
? document.body.appendChild(objDiv);
}