在js中创建一个div,以及对div的一些操作。
- var bottomer=document.createElement("div");//创建一个div对象(背景层)
- //定义div属性
- bottomer.setAttribute("id","btDiv");
- bottomer.style.position="absolute";
- bottomer.style.background="#777";
- bottomer.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
- bottomer.style.opacity="0.6";
- bottomer.style.top = "96%";
- bottomer.style.padding = "10px";
- bottomer.style.width="100%";
- bottomer.style.height="100%";
- bottomer.style.zIndex = "10000";
- bottomer.style.backgroundImage = "url(p_w_picpath/login.jpg)";
- bottomer.innerHTML = "台电科技";
- bottomer.style.fontSize = "15px";
- bottomer.style.textAlign = "left";
- document.body.appendChild(bottomer);//在body内添加该div对象
转载于:https://blog.51cto.com/becomedragon/872293