1.创建dom元素的操作
<script type='text/javascript'> function main(){ var mydiv = document.createElement('div'); mydiv.style.overFlow = 'hidden'; mydiv.style.width = '200px'; mydiv.style.left = '0px'; mydiv.style.paddingTop = '10px'; mydiv.style.paddingLeft = '4px'; mydiv.style.height = '66px'; //mydiv.style.overflowX = 'scroll'; mydiv.style.overflowY = 'scroll'; mydiv.style.backgroundColor = '#aabb33'; mydiv.style.position = 'absolute'; // mydiv.style.maxHeight = '66px'; var str = ''; for(var i = 0;i<20;i++){ str+='hello,it\'s div <br />'; } mydiv.innerHTML = str; document.body.appendChild(mydiv); var myb = document.createElement('b'); myb.innerHTML = 'test b'; document.body.appendChild(myb); }
?