`

模似html元素tilte提示

阅读更多
<html>
<head>
<title>div模拟title</title>
</head>
<body>
<script>
    document.write('<div id=pltsTipLayer style="display: none;position: absolute;z-index:10001"></div>');  
    function pltsinits()  
    {  
        document.onmouseover   = plts;  
        document.onmousemove = moveToMouseLoc;  
    }  
    function plts()  
    {   
        var o=event.srcElement; 
        if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};  
        if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};  
        var pltsPop=o.dypop;  
        if(pltsPop!=null&&pltsPop!=""&typeof(pltsPop)!="undefined")  
        {  
            pltsTipLayer.style.left=-1000;  
            pltsTipLayer.style.display='';  
            var Msg=pltsPop.replace(/\n/g,"<br>");  
            MsgMsg=Msg.replace(/\0x13/g,"<br>");  
            var re=/\{(.[^\{]*)\}/ig;  
            MsgMsg=Msg.replace(re,"");  
            MsgMsg=Msg.replace("<br>","");  
            var content ='<table style="FILTER:alpha(opacity=90) shadow(color=#bbbbbb,direction=135);" id=toolTipTalbe ><tr><td width="100%"><table  cellspacing="1" cellpadding="0" style="width:100%;solid; "><tr><td style="padding-left:14px;padding-right:14px;padding-top: 6px;padding-bottom:6px;line-height:135%;background-color: #FFFFE1;font-size:12px;">'+Msg+'</td></tr></table></td></tr></table>';  
           pltsTipLayer.innerHTML=content;  
           toolTipTalbe.style.width=Math.min(pltsTipLayer.clientWidth,document.body.clientWidth/2.2);  
           moveToMouseLoc();  
           return true;  
        }else{  
          pltsTipLayer.innerHTML='';  
          pltsTipLayer.style.display='none';  
          return true;  
        }  
    }  
      
    function moveToMouseLoc()  
    {  
        var pltsoffsetX = 5;   // 弹出窗口位于鼠标左侧或者右侧的距离;3-12 合适  
        var pltsoffsetY = 5; // 弹出窗口位于鼠标下方的距离;3-12 合适  
        var popLeftAdjust =0;  
        var popLeftAdjust =0;  
        if(pltsTipLayer.innerHTML=='')return true;  
        var MouseX=event.x;  
        var MouseY=event.y;  
        //window.status=event.y;  
        var popHeight=pltsTipLayer.clientHeight;  
        var popWidth=pltsTipLayer.clientWidth;  
        if(MouseY+pltsoffsetY+popHeight>document.body.clientHeight){  
           popTopAdjust=-popHeight-pltsoffsetY*1.5;  
        }else{  
            popTopAdjust=0;  
        }  
        if(MouseX+pltsoffsetX+popWidth>document.body.clientWidth){  
           popLeftAdjust=-popWidth-pltsoffsetX*2;  
        }else{  
           popLeftAdjust=0;  
        }  
        if(MouseX+pltsoffsetX+document.body.scrollLeft+popLeftAdjust<0){
            pltsTipLayer.style.left=document.body.scrollLeft; 
        } else{
            pltsTipLayer.style.left=MouseX+pltsoffsetX+document.body.scrollLeft+popLeftAdjust; 
        }
        if(MouseY+pltsoffsetY+document.body.scrollTop+popTopAdjust<0){
            pltsTipLayer.style.top=document.body.scrollTop;
        }else{
            pltsTipLayer.style.top=MouseY+pltsoffsetY+document.body.scrollTop+popTopAdjust;
        }
        return true;  
    }  
    pltsinits();  
</script>
<a href="#" title="活动简介

在这里,写下你们的生日,谁是那个与你同年同月同日生的有缘人呢?一起等待,一起去下面的活动讨论里去寻找 …… 
   
有缘的人们,设置头像完备资料,踊跃地互相关注起来吧~">我爱我家</a>
<a title="cccccccccccccccc">qweqw</a>
</body></html>
分享到:
评论

相关推荐

    em78p259 C语言 头文件

    * Tilte: EM78P259 include file * * Description: The Definition of EM78P259 Registers * * Company: HONGSUO LTD. * Author: JIANGKE * * Date: 7/03/2006 * * Version: * ******************...

    自定义Dialog弹窗

    public Builder setTitle(String tilte) { dialog.mTilte = tilte; return this; } /** * 设置右侧按钮的显示文字,默认为确定 * * @param positiveText 按钮上的显示内容 */ public Builder ...

    Android 自定义Dialog去除title导航栏的解决方法

    今天小编就为大家分享一篇Android 自定义Dialog去除title导航栏的解决方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧

    react-native-animated-carousel:React用于React-Native的精彩的动画carouel钩子组件

    大家好! :unicorn: 这是React-Native精彩...animated-carousel --save进口import AnimatedCarousel from 'react-native-animated-carousel'演示版const testData = [ { title:'tilte1', subTitle:'副标题1', bgImage:'...

    ASP和PHP实现生成网站快捷方式并下载到桌面的方法

    在网站上设置“加入收藏、设为首页”等按钮是一般网站都会干的...== “”) $title = trim($_GET[tilte]);$content=’[DEFAULT]BASEURL=https://www.jb51.net/?desktop[{000214A0-0000-0000-C000-000000000046}]Prop3=19

    .Net(c#)汉字和Unicode编码互相转换实例

    {Tilte: \u535a\u5ba2\u56ed, Href: //www.jb51.net} 经常遇到这样内容的json字符串,原来是把其中的汉字做了Unicode编码转换。 Unicode编码: 将汉字进行UNICODE编码,如:“王”编码后就成了“\王”,UNICODE字符...

    达内客户端+聊天室源码

    * 遍历回帖集合,取出每一条回帖记录,分割成一组回帖信息元素, * 进行处理后添加进二维集合 */ for(int i = 1;i;i++){ String ansStr = ansArr[i]; answer = ansStr.split("(|)"); vvs.add(new ...

    flash image silde show ( Open Source)

    channel.itme.tilte 对应图片的标题 设置 config.roundCorner 图片的圆角 config.autoPlayTime 图片切换时间,默认值是8,单位秒 config.isHeightQuality 图片缩小是否采用高质量的方法,默认值false config....

    用于1064 nm波段的45°倾斜光纤光栅的研制及其偏振特性研究

    研究分析了45°倾斜光纤光栅的工作机理。利用紫外曝光法,将周期为1070 nm 的相位模板旋转一定角度后,在光敏光纤上成功写制了45°倾斜光纤光栅,通过拼接写制技术,写制的光栅栅区长度为24 mm。...

    千瓦级高光束质量半导体激光线阵合束光源

    低光束质量严重限制了大功率半导体激光器的应用,为了满足日益增长的工业和国防领域应用需求,发展兼具高功率和高光束质量激光输出的半导体激光光源具有重要意义。采用线阵合束方式集成20个传导热沉封装半导体激光...

    NOA73材料的微透镜阵列快速制造技术

    针对传统微透镜阵列制作工艺复杂、成本高、周期长等缺点,研究了一种低成本、高效率制作微透镜阵列的技术方法。以SU-8负性光刻胶为主模结构材料,采用2次紫外斜曝光工艺,加工出主光轴平行于硅基的微透镜阵列作为主...

Global site tag (gtag.js) - Google Analytics