想制作一个浮动层,像http://www.opple-lighting.com/右下角那个send message.
固定在浏览器右下角.
 该怎么实现呢?

解决方案 »

  1.   

    浮动广告?使用div.style和document.body来精确定位
      

  2.   

    <html>
    <script>
    var imgPanel = document.createElement("img");
    imgPanel.src = "http://www.cnblogs.com/images/logo_small.gif"; function FloatDiv(youPanel)
    {
    this.container = document.createElement("div");
    this.container.appendChild(youPanel);
    this.innerPanel = youPanel;
    this.container.style.position = "fixed";//这个属性会保持你这个container的决定位置
    this.container.style.right = "0px";//设置靠右边
    //this.container.style.top = "100px";//设置Y轴位置
    this.container.style.bottom = "10px";//设置Y轴位置
    document.body.appendChild(this.container);
    } function doSomething()
    {
    //首先添加一些占空间的div
    for(var i = 0; i < 100; i++)
    {
    var split = document.createElement("div");
    split.innerHTML = "the " + i +" line";
    document.body.appendChild(split);
    } //新建一个浮动div,把你想要放进去的东西给塞进去就好了
    new FloatDiv(imgPanel);
    }
    </script>
    <body onload="doSomething()">
    </body>
    </html>