createElement "DIV" Change other element position <div id="aa"><img src="http://www.google.com/intl/en_ALL/images/logo.gif" /></div> <script> function ss(){ var _div=document.createElement("div") _div.style.overflow="hidden" _div.appendChild(document.getElementById("aa")) document.body.appendChild(_div) } </script> <input type="button" value="button" onclick="ss()" />
Umm... Is your problem that when the ss function is called, the existing elements on the page are moved around? It kind of makes sense that creating a new div inside a document would cause the page to re-flow to make room for the new div. Could you post the whole page showing the error, so that we can have some context?