• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
云飞
博客园    首页    新随笔    联系   管理    订阅  订阅

显示一行省略文字的详细信息

 function hindenMsg(e) {
            document.getElementById("tipDiv").style.display = "none";
        }

        var offX = 2;
        var offY = 0;
        var width = 0;
        var height = 0;
        var scrollX = 0;
        var scrollY = 0;
        var x = 0;
        var y = 0;
        function conentall(msg) {
            var tip = parent.document.getElementById("tipDiv");
            tip.style.display = "inline";
            tip.innerHTML = "<div><div class='innertip'><p class='innertip'>" + msg + "</p></div></div>";

            if (window.innerWidth) width = window.innerWidth - 18;
            else if (document.documentElement && document.documentElement.clientWidth)
                width = document.documentElement.clientWidth;
            else if (document.body && document.body.clientWidth)
                width = document.body.clientWidth;

            if (window.innerHeight) height = window.innerHeight - 18;
            else if (document.documentElement && document.documentElement.clientHeight)
                height = document.documentElement.clientHeight;
            else if (document.body && document.body.clientHeight)
                height = document.body.clientHeight;

            if (typeof window.pageXOffset == "number") scrollX = window.pageXOffset;
            else if (document.documentElement && document.documentElement.scrollLeft)
                scrollX = document.documentElement.scrollLeft;
            else if (document.body && document.body.scrollLeft)
                scrollX = document.body.scrollLeft;
            else if (window.scrollX) scrollX = window.scrollX;

            if (typeof window.pageYOffset == "number") scrollY = window.pageYOffset;
            else if (document.documentElement && document.documentElement.scrollTop)
                scrollY = document.documentElement.scrollTop;
            else if (document.body && document.body.scrollTop)
                scrollY = document.body.scrollTop;
            else if (window.scrollY) scrollY = window.scrollY;

            x = event.pageX ? event.pageX : event.clientX + scrollX;
            y = event.pageY ? event.pageY : event.clientY + scrollY;

            if (x + tip.offsetWidth + offX > width + scrollX) {
                x = x - tip.offsetWidth - offX;
                if (x < 0) x = 0;
            } else x = x + offX;
            if (y + tip.offsetHeight + offY > height + scrollY) {
                y = y - tip.offsetHeight - offY;
                if (y < scrollY) y = height + scrollY - tip.offsetHeight;
            } else y = y + offY;
            tip.style.left = x + "px";
            tip.style.top = y + "px";
        }
<div id="tipDiv" style="border-right: #333366 1px solid; border-top: #333366 1px solid;
            display: none; z-index: 1; border-left: #333366 1px solid; border-bottom: #333366 1px solid;
            position: absolute;background-color: #ffffcc;">
        </div>

 

 
posted @ 2013-11-12 15:49  映日荷花别样红  阅读(188)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3