1.动态创建DIV

function appendImageDIV(){
    if ((etIE || etDOM)) {
        var obody = document.getElementsByTagName('BODY').item(0);       
        var imageDIV = document.createElement("DIV");
        imageDIV.id = WEBTOUCH_IMAGE_DIV_ID;
        imageDIV.style.display = "none";
        imageDIV.style.position = "absolute";
        imageDIV.style.zIndex = 999999999;
        obody.appendChild(imageDIV);       
        var content = '<img src="'+DYNAMIC_AGENT_CHAT_URL+CHAT_OFF_IMAGE+'"  id="'+TAG_FOR_IMAGE+'" />';
        imageDIV.innerHTML = content;
    }
}

2.DIV 屏幕位置不变

<div id="Float21789" style="position: absolute; z-index: 9; width: 190px; top: 200px;
        right: 3px;">
        <center>
            <div id="AD21789" style="width: 190px; height: 90px; text-align: center; float: none;">
                <a href="http://forum.csdn.net/PointForum/Forum/PostTopic.aspx" target="_blank">
                    <img src="http://community.csdn.net/ui/homepage/images/questions.gif" alt="提问" style="width: 180px;
                        height: 50px; padding-right: 3px;" /></a>
            </div>
        </center>
    </div>

    <script type="text/javascript" language="JavaScript">
    var csdnScrollTop=function(){
        return document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
        };
        function mymove21789(){
        document.getElementById("Float21789").style.top=csdnScrollTop()+300+'px';document.getElementById("Float21789").style.right=3+'px';setTimeout("mymove21789();",50);
        }
        mymove21789();
    </script>

3.为事件添加方法

if (window.addEventListener) {
    window.addEventListener('scroll', playImgFloatPosition, false);
    window.addEventListener('resize', playImgFloatPosition, false);
}
 if (window.attachEvent) {
      window.attachEvent('onscroll', playImgFloatPosition);
      window.attachEvent('onresize', playImgFloatPosition);
}


------君临天下,舍我其谁------