hao_2468

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

<!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>无标题文档</title>
<script>
    function vis(obj){

     var od = document.getElementById('od'), o = obj, x = 0, y = 0, h = obj.offsetHeight;
     while(o != null){
            x += o.offsetLeft;
            y += o.offsetTop;
            o = o.offsetParent;
        }
        od.style.left = x+'px';
        od.style.top = y+ h +'px';
        od.style.visibility = 'visible';
    }
    function hid(){
        document.getElementById('od').style.visibility = 'hidden';
    }
</script>
</head>
<body>
<div id="od" style="visibility:hidden; position:absolute; width:50px; height:100px; border:1px solid #00f">一个DIV</div>
<a href="#" onclick="vis(this)" onmouseout="hid()">第一个文本框</a> <a href="#" onclick="vis(this)" onmouseout="hid()">第二个广本框</a>
</body>
</html>

posted on 2009-09-11 11:46  hao_2468  阅读(96)  评论(0编辑  收藏  举报