[HELP]createElement "DIV" Change other element position

Discussion in 'JavaScript' started by insomnia2008, Sep 20, 2007.

  1. #1
    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()" />
     
    insomnia2008, Sep 20, 2007 IP
  2. KatieK

    KatieK Active Member

    Messages:
    116
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #2
    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?
     
    KatieK, Sep 20, 2007 IP