http://shopping.naver.com/  页面左上 的那个js效果啊

解决方案 »

  1.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>test</title>
    <script type="text/javascript">
    function Show(sender)
    {
    document.getElementById("test").style.display = "block";
    var leftpos = 0,toppos = 0;
    var pObject = sender.offsetParent;
    if (pObject)
    {
    leftpos += pObject.offsetLeft;
    toppos += pObject.offsetTop;
    }
    while(pObject=pObject.offsetParent )
    {
    leftpos += pObject.offsetLeft;
    toppos += pObject.offsetTop;
    }; document.getElementById("test").style.left = (sender.offsetLeft + leftpos) + "px";
    document.getElementById("test").style.top = (sender.offsetTop + toppos + sender.offsetHeight - 2) + "px"; }
    function Hide(sender)
    {
    document.getElementById("test").style.display = "none";
    }
    </script>
    </head><body>
    <a href="#" onmousemove="Show(this)" onmouseout="Hide(this)">onmouseover</a>
    <div id="test" style="position: absolute; border-right: #a5a5a5 1px solid;
    padding-right: 10px; border-top: #a5a5a5 1px solid; padding-left: 15px; padding-bottom: 12px;
    border-left: #a5a5a5 1px solid; width: 300px; padding-top: 12px; border-bottom: #a5a5a5 1px solid;
    background-color: #ffffff; display: none" onmouseover="this.style.display='block'"
    onmouseout="this.style.display='none'">test<br />test<br />test<br />test<br />test<br />test<br />test<br />test</div>
    </body>
    </html>
      

  2.   

    和csdn这个一样,用ajax做就可以了 啊
      

  3.   

     啊 不要ajax撒 我不会啊 先说用js怎么弄啊
      

  4.   

    给你一个DIV的定位方法
     function getInfo(o)
            {//取得坐标
                var to=new Object();
                to.left=to.right=to.top=to.bottom=0;
                var twidth=o.offsetWidth;
                var theight=o.offsetHeight;
                while(o!=document.body)
                {
                    to.left+=o.offsetLeft;
                    to.top+=o.offsetTop;
                    o=o.parentElement;
                }
                to.right=to.left+twidth;
                to.bottom=to.top+theight;
                return to;
            }
    我在CSDN上发了一个资源,叫拖动购物车,上面有在列表边加载产品信息的方法
    建议你看一下,不过最好在51aspx 上去下,51aspx把我的资源转载了,也把数据库加上去了