zoukankan
html css js c++ java
自动提示效果
前阵子,IE的title提示突然罢工了,找了很多原因就是没找到,一次实验popup.show后,它居然会出来,可是要让title出来前每次都必须调用popup.show方法,这怎么行呢
,估计还是注册表的问题吧,终于放弃,于是制作了这个简单的自动提示js文件。支持firefox&ie,也不会有自带的提示那种过一段时间消失的问题了。
<
html
>
<
head
>
<
title
>
tip
</
title
>
<
meta
http-equiv
="Content-Type"
content
="text/html; charset=gb2312"
>
</
head
>
<
body
>
<
script
>
if
(
!
document.attachEvent)
{
document.attachEvent
=
function
()
{document.addEventListener(arguments[
0
].substr(
2
),arguments[
1
],arguments[
2
])}
}
document.attachEvent(
"
onmouseover
"
,
function
(e)
{
var
tip
=
""
;
if
(
typeof
(event)
==
"
undefined
"
)
{
tip
=
e.target.getAttribute(
"
tips
"
)
}
else
{
e
=
event;
tip
=
e.srcElement.tips;
}
if
(
typeof
(tip)
!=
"
undefined
"
&&
tip.length
>
0
)
{
var
_tips
=
document.getElementById(
"
myTip
"
);
if
(
typeof
(_tips)
==
"
undefined
"
||
_tips
==
null
)
{
_tips
=
document.createElement(
"
div
"
);
_tips.id
=
"
myTip
"
;
_tips.style.position
=
"
absolute
"
;
_tips.style.width
=
"
150px
"
;
_tips.style.borderWidth
=
"
1px
"
;
_tips.style.borderStyle
=
"
solid
"
;
_tips.style.borderColor
=
"
gray
"
;
_tips.style.fontSize
=
"
9pt
"
;
_tips.style.backgroundColor
=
"
#ffffff
"
;
_tips.style.color
=
"
#349045
"
;
_tips.style.filter
=
"
progid:DXImageTransform.Microsoft.Shadow(color=#999999,direction=135,strength=3)
"
;
_tips.style.padding
=
"
5px 8px 3px 8px
"
;
document.body.appendChild(_tips);
_tips.style.display
=
"
none
"
;
}
_tips.style.display
=
""
;
_tips.innerHTML
=
tip;
_tips.style.left
=
document.body.scrollLeft
+
e.clientX
+
10
;
_tips.style.top
=
document.body.scrollTop
+
e.clientY
+
10
;
}
}
);
document.attachEvent('onmouseout',
function
(e)
{
var
_tips
=
document.getElementById(
"
myTip
"
);
if
(_tips
!=
null
)
{
_tips.style.display
=
"
none
"
;
}
}
)
</
script
>
<
a
href
="#"
tips
="自定义提示"
>
测试链接
</
a
>
<
a
href
="#"
>
测试链接
</
a
>
<
a
href
="#"
tips
="中华人民共和国中华人民共和国自中华人民共和国中华人民共和国自定义提示中华人民共和国中华人民共和国自定义提示中华人民共和国中华人民共和国自定义提示定义提示"
>
测试链接
</
a
>
</
body
>
</
html
>
查看全文
相关阅读:
Sort-20191304商苏赫
Myod-20191304商苏赫
Linux C语言编程基础-20191304商苏赫
《Unix/Linux系统编程》第十章学习笔记-20191304商苏赫
《Unix/Linux系统编程》第九章学习笔记 --20191304商苏赫
《Unix/Linux系统编程》第一、二章学习笔记,知识点归纳及收获
20191325学习笔记6
20191325学习笔记5
20191325第七八章学习笔记
2021.10.9测试二20191325
原文地址:https://www.cnblogs.com/qfb620/p/1109458.html
最新文章
师生关系
关于《计算机科学概论》的问题与疑惑
个人简介
cat userlist
实现ls
ls的功能
syscalls1
学习笔记6
学习笔记5
学习笔记4
热门文章
sort
MyOD
《信息安全系统设计与实现》学习笔记三
BASE64编码作业
2019-2020-1 20191323《信息安全专业导论》第二周学习总结
快速浏览教材
20191323的自我介绍
《Unix/Linux系统编程》第三章学习笔记
《Unix/Linux系统编程》第十一章学习笔记-20191304商苏赫
《Linux/Unix系统编程》第七、八章学习笔记-20191304商苏赫
Copyright © 2011-2022 走看看