1. <html>
  2. <head>
  3. <title>title及alt提示特效</title>
  4. <style type="text/css">
  5. body{font-size:12px;color:#000000}
  6. td{font-size:12px;color:#000000}
  7. a:link{font-size:12px;color:#000000}
  8. </style>
  9. <script language="javascript">
  10. var pltsPop=null;
  11. var pltsoffsetX = 12; // 弹出窗口位于鼠标左侧或者右侧的距离;3-12 合适
  12. var pltsoffsetY = 15; // 弹出窗口位于鼠标下方的距离;3-12 合适
  13. var pltsTitle="";
  14. document.write('<div id=pltsTipLayer style="display: none;position: absolute; z-index:10001"></div>');
  15. function pltsinits()
  16. {
  17. document.onmouseover = plts;
  18. document.onmousemove = moveToMouseLoc;
  19. }
  20. function plts()
  21. { var o=event.srcElement;
  22. if(o.alt!=null && o.alt!=""){oo.dypop=o.alt;o.alt=""};
  23. if(o.title!=null && o.title!=""){oo.dypop=o.title;o.title=""};
  24. pltsPop=o.dypop;
  25. if(pltsPop!=null && pltsPop!="" && typeof(pltsPop)!="undefined")
  26. {
  27. pltsTipLayer.style.left=-1000;
  28. pltsTipLayer.style.display='';
  29. var Msg=pltsPop.replace(/\n/g,"<br>");
  30. MsgMsg=Msg.replace(/\0x13/g,"<br>");
  31. var re=/\{(.[^\{]*)\}/ig;
  32. if(!re.test(Msg))pltsTitle="『水木设计联盟』";
  33. else{
  34. re=/\{(.[^\{]*)\}(.*)/ig;
  35. pltsTitle=Msg.replace(re,"$1")+" ";
  36. re=/\{(.[^\{]*)\}/ig;
  37. MsgMsg=Msg.replace(re,"");
  38. MsgMsg=Msg.replace("<br>","");}
  39. var content =
  40. '<table style="FILTER:alpha(opacity=90);border: 1px solid #cccccc" id="toolTipTalbe" cellspacing="1" cellpadding="0"><tr><td width="100%"><table bgcolor="#ffffff" cellspacing="0" cellpadding="0">'+
  41. '<tr id="pltsPoptop"><td height="20" bgcolor="#0094bb"><font color="#ffffff"><b><p id="topleft" align="left">↖'+pltsTitle+'</p><p id="topright" align="right" style="display:none">'+pltsTitle+'↗</font></b></font></td></tr>'+
  42. '<tr><td "+attr+" style="padding-left:10px;padding-right:10px;padding-top: 8px;padding-bottom:6px;line-height:140%">'+Msg+'</td></tr>'+
  43. '<tr id="pltsPopbot" style="display:none"><td height="20" bgcolor="#0094bb"><font color="#ffffff"><b><p id="botleft" align="left">↙'+pltsTitle+'</p><p id="botright" align="right" style="display:none">'+pltsTitle+'↘</font></b></font></td></tr>'+
  44. '</table></td></tr></table>';
  45. pltsTipLayer.innerHTML=content;
  46. toolTipTalbe.style.width=Math.min(pltsTipLayer.clientWidth,document.body.clientWidth/2.2);
  47. moveToMouseLoc();
  48. return true;
  49. }
  50. else
  51. {
  52. pltsTipLayer.innerHTML='';
  53. pltsTipLayer.style.display='none';
  54. return true;
  55. }
  56. }
  57. function moveToMouseLoc()
  58. {
  59. if(pltsTipLayer.innerHTML=='')return true;
  60. var MouseX=event.x;
  61. var MouseY=event.y;
  62. var popHeight=pltsTipLayer.clientHeight;
  63. var popWidth=pltsTipLayer.clientWidth;
  64. if(MouseY+pltsoffsetY+popHeight>document.body.clientHeight)
  65. {
  66. popTopAdjust=-popHeight-pltsoffsetY*1.5;
  67. pltsPoptop.style.display="none";
  68. pltsPopbot.style.display="";
  69. }
  70. else
  71. {
  72. popTopAdjust=0;
  73. pltsPoptop.style.display="";
  74. pltsPopbot.style.display="none";
  75. }
  76. if(MouseX+pltsoffsetX+popWidth>document.body.clientWidth)
  77. {
  78. popLeftAdjust=-popWidth-pltsoffsetX*2;
  79. topleft.style.display="none";
  80. botleft.style.display="none";
  81. topright.style.display="";
  82. botright.style.display="";
  83. }
  84. else
  85. {
  86. popLeftAdjust=0;
  87. topleft.style.display="";
  88. botleft.style.display="";
  89. topright.style.display="none";
  90. botright.style.display="none";
  91. }
  92. pltsTipLayer.style.left=MouseX+pltsoffsetX+document.body.scrollLeft+popLeftAdjust;
  93. pltsTipLayer.style.top=MouseY+pltsoffsetY+document.body.scrollTop+popTopAdjust;
  94. return true;
  95. }
  96. pltsinits();
  97. </script>
  98. </head>
  99. <body>
  100. 链接提示效果:<a href="http://www.lanrentuku.com/" target="_blank" title="title及alt提示特效,本程序由水木设计联盟整理推荐,希望大家喜欢">一个很酷的鼠标悬停特效,但有问题指教,我想知道怎么控制悬停时间</a>
  101. </body>
  102. </html>

  

title及alt提示特效的更多相关文章

  1. title与alt的区别

    html中的title属性和alt属性让人有些混淆. 以前不知道有title这个属性,第一次用到它时,就和alt产生了混淆.一位朋友告诉我说,alt是图片img标签里用的,title是超链接里用的, ...

  2. 【转】title与alt的区别

    html中的title属性和alt属性让人有些混淆. 以前不知道有title这个属性,第一次用到它时,就和alt产生了混淆.一位朋友告诉我说,alt是图片img标签里用的,title是超链接里用的,当 ...

  3. html中的title和alt

    alt是html标签的属性,而title既是html标签,又是html属性. title标签这个不用多说,网页的标题就是写在<title></title>这对标签之内的.tit ...

  4. <img>的title和Alt有什么区别?

    Alt是<img>的特有属性,是图片内容的等价描述,用于图片无法加载时显示,读屏器阅读图片. title 可提高图片高可访问性,除了纯装饰图片外都必须设置有意义的值,搜索引擎会重点分析.鼠 ...

  5. 如何写一个网页标题title的闪动提示(转)

    通过网页title来提示用户有新消息这个功能很常见,比如现在的微博,还有一些邮箱,这个功能都很常见.如何实现则个功能呢? 思路是:通过ajax访问后台,若有新消息,则将网页的title替换为 提示信息 ...

  6. 如何写一个网页标题title的闪动提示

    通过网页title来提示用户有新消息这个功能很常见,比如现在的微博,还有一些邮箱,这个功能都很常见.如何实现则个功能呢? 思路是:通过ajax访问后台,若有新消息,则将网页的title替换为 提示信息 ...

  7. css3 小图标提示特效

    最近的计划,就是每天来几个特效,当然这里有限制,在什么候选区只能放一个,还每天有限制发布的,哎, 啊 终于写完了,看到一个挺好玩的东西,想到能不能用网页的特效做出来,试试呗!不过,一想肯东有很多的 相 ...

  8. 手写一个关于title属性自定义提示框解决浏览器(IE)不兼容问题

    <html> <head> <meta charset="utf-8"> <title>无标题页</title> < ...

  9. 5.href和src区别? title和alt【CSS】

    1.href (Hypertext Reference)指定网络资源的位置(超文本引用),从而在当前元素或者当前文档和由当前属性定义的需要的锚点或资源之间定义一个链接或者关系,在 link和a 等元素 ...

随机推荐

  1. [转]Windows网络编程学习-面向连接的编程方式

    直接附上原文链接:windows 网络编程学习-面向连接的编程方式

  2. 使用js使某个按钮在5秒内不能重复点击

    <head> <!--参考:http://illy.iteye.com/blog/1534276 --> <!-- http://y.dobit.top/Detail/1 ...

  3. Android自动化压力测试图解教程——Monkey工具

    [置顶] Android自动化压力测试图解教程--Monkey工具 标签: 测试androidprofiling工具测试工具文档 2012-04-01 10:16 38185人阅读 评论(10) 收藏 ...

  4. JSTL 标签库 使用

    标签库概要: 一.C标签库介绍 1.1.<c:> 核心标签库  JSTL 核心标签库(C标签)标签共有13个,功能上分为4类:1.表达式控制标签:out.set.remove.catch2 ...

  5. [CareerCup] 2.6 Linked List Cycle 单链表中的环

    2.6 Given a circular linked list, implement an algorithm which returns the node at the beginning of ...

  6. 文本模板转换工具包和 ASP.NET MVC

    http://msdn.microsoft.com/zh-sg/magazine/ee291528.aspx

  7. 要期末了搞不了OI了额……

    TAT~~~~~~期中完挂,求RP求期末逆袭

  8. Pell方程及其一般形式

    一.Pell方程 形如x^2-dy^2=1的不定方程叫做Pell方程,其中d为正整数,则易得当d是完全平方数的时候这方程无正整数解,所以下面讨论d不是完全平方数的情况. 设Pell方程的最小正整数解为 ...

  9. C#基础知识系列六(静态类和静态类成员)

    静态类 静态类与非静态类基本相同,但存在一个区别:静态类不能实例化. 也就是说,不能使用 new 关键字创建静态类类型的变量. 因为没有实例变量,所以要使用类名本身访问静态类的成员. 例如,如果名为 ...

  10. WRONGTYPE Operation against a key holding the wrong kind of value

    今天改动代码,一运行就跑错了,错误原因: 因为redis中已经存在了相同的key, 而且key对应的值类型并不是Set,而是SortSet(改动前):再调用smembers时,抛出此错误. 解决方法: ...