惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
D
Docker
有赞技术团队
有赞技术团队
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
爱范儿
爱范儿
H
Help Net Security
美团技术团队
MyScale Blog
MyScale Blog
B
Blog RSS Feed
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
阮一峰的网络日志
阮一峰的网络日志
A
About on SuperTechFans
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
G
Google Developers Blog
月光博客
月光博客
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs

博客园 - Dawnxu

修改的Flash + ASP.NET 拍照程序 AjaxPro在Windows 2000 server下不能正常使用的解决方案 MSN 8.0 邀请函! RAR 命令 新版XNet.SqlHelper 很不错的Windows 控件 Developer Express Inc.NET 鼠标按住任意控件拖动窗口 61条面向对象设计的经验原则 两个WEB程序之间的通信 本人还有50份GMail邀请函,要的请留言! 关于俱乐部活动的个人想法! 操作MS SQL Server 存储过程的类(外加ASP.NET MessageBox类) 大学毕业了再看你会后悔一辈子的 妙用Asp.Net中的HttpHandler [转载]ASP.NET分页的处理方式 [转载]ASP.NET开发经验积累 WINDOWS2000开机硬盘自动共享 [转载]无组件上传程序ASP.NET版 C#实现的根据年月日计算星期几的函数
修改的一个Title提示
Dawnxu · 2005-08-09 · via 博客园 - Dawnxu

使用:

<href="#" tips="自定义提示内容" title="标题">测试</a>


 
JS:

 1 
 2 <script language=JavaScript>  
 3 if(!document.attachEvent)
 4 {
 5     document.attachEvent = function(){document.addEventListener(arguments[0].substr(2),arguments[1],arguments[2])}
 6 }
 7 
 8 document.attachEvent("onmousemove",function(e)
 9 {
10  var MouseX=event.x;
11  var MouseY=event.y;
12     var tip = "";
13  var title="";
14 
15     if(typeof(event)=="undefined"){
16         tip = e.target.getAttribute("tips")
17   title = e.target.getAttribute("title")
18     }else{
19         e    = event;
20         tip = e.srcElement.tips;
21   title = e.srcElement.title;
22     }
23 
24     
25     if(typeof(tip)!="undefined"&&tip.length>0)
26     {
27         var _tips = document.getElementById("myTip");
28         
29         if(typeof(_tips)=="undefined"||_tips == null)
30         {
31             _tips        = document.createElement("div");
32             _tips.id     = "myTip";
33             _tips.style.position        = "absolute";
34 
35             _tips.style.borderWidth        = "0px";
36             _tips.style.borderStyle        = "solid";
37             _tips.style.borderColor        = "gray";
38             _tips.style.fontSize           = "9pt";
39             _tips.style.backgroundColor    = "#ffffff";
40             _tips.style.color              = "#FF0000";
41 
42             
43             //_tips.style.filter            = "progid:DXImageTransform.Microsoft.Shadow(color=#999999,direction=135,strength=3)";
44             _tips.style.padding            = "0px 0px 0px 0px";
45             
46 
47             document.body.appendChild(_tips);            
48             _tips.style.display            = "none";
49         }
50    if(tip.length>0&&tip.length<50)
51    {
52             _tips.style.width              = "100px";
53    }
54    else if(tip.length>50&&tip.length<100)
55    {
56     _tips.style.width            = "250px";
57    }
58    else
59    {
60     _tips.style.width            = "300px";
61    }
62 
63             _tips.style.display    = "";
64             var tbstring = "<table id=toolTipTalbe  cellspacing=1 cellpadding=1 width='100%' bgcolor=#92B4E7 border=0>";
65       tbstring +="<tr><td height=16 style='FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#96bffd, EndColorStr=#bedbff)'>";
66       tbstring +="<P><font color='RED'>" + title +"</font></P>";
67       tbstring +="</td></tr>";
68       tbstring +="<tr><td width='100%' valign='top' bgcolor='#ECF2FB' style='PADDING-RIGHT: 1px;PADDING-BOTTOM: 1px'>";
69       tbstring += tip;
70       tbstring +="</td></tr></table>";
71             _tips.innerHTML        = tbstring;
72             
73             _tips.style.left    = e.clientX+10;
74             _tips.style.top        = e.clientY+10;
75         //    var myTip =document.getElementById('toolTipTalbe');
76             
77    //document.write(tb.width);
78   // if(MouseY + myTip.style.width>document.body.clientWidth)
79    //{
80    // _tips.style.left    = e.clientX-1000;
81    // _tips.style.top        = e.clientY-1000;
82    //}
83   // document.getElementById('Text1').value="MouseY=" + MouseY + " myTip.width=" + tip.length*12/250 +" clientWidth="+document.body.clientWidth;
84     }
85 }
86 );
87 
88 document.attachEvent('onmouseout',function(e)
89 {   
90     var _tips = document.getElementById("myTip");
91     if(_tips!=null)
92     {
93         _tips.style.display="none";
94     }
95 }
96 )
97 
98 </script>

posted @ 2005-08-09 11:43  Dawnxu  阅读(516)  评论()    收藏  举报