margin: 5px;
float: left;
border: 1px solid #ccc;
}
script标签中:
//创建2个div元素
var rightdiv = document.createElement(‘div’)
//给2个div设置不同的属性
rightdiv.setAttribute(‘class’, ‘right’) //设置class为right
rightaaron.innerHTML = “动态创建DIV元素节点”;
//绘制到页面body
body.appendChild(rightdiv)
1.1.2 JS页面中
var LegendDIV=document.createElement(“div”);
LegendDIV.id=“legendContainer”;
LegendDIV.style.backgroundColor =“#FFFFFF”;
LegendDIV.style.width=“100px”;
LegendDIV.style.height=“320px”;
LegendDIV.style.position=“absolute”;
LegendDIV.style.top=‘520px’;
LegendDIV.style.left=“85%”;
//LegendDIV.style.border=“1px groove DodgerBlue”;
LegendDIV.style.backgroundColor=‘rgba(255,255,255,0)’
LegendDIV.style.display=“block”;
document.body.appendChild(