分享
 
 
 

实现鼠标经过超链时的提示图层

王朝other·作者佚名  2006-12-16
窄屏简体版  字體: |||超大  

<script>

var oPopup = window.createPopup();

function rdl_doClick(){

var oMessage=document.all("oMessage");

with (oPopup.document.body) {

style.backgroundColor="lightyellow";

style.border="solid black 1px";

innerHTML=oMessage.value;

}

oPopup.show(70, 70, 180, 60);

}

</script>

<input id=oMessage type=text size=40 value="点击弹出窗口外面的区域关闭它。">

<br><br>

<a href="#" onmouseover="rdl_doClick()" onmouseout="oPopup.hide();">显示弹出窗口 </a>

还有用titile

运行代码框

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<STYLE type=text/css>BODY {

MARGIN-TOP: 0px; FONT-SIZE: 9pt; MARGIN-LEFT: 4px; MARGIN-RIGHT: 0px; FONT-FAMILY: "宋体"

}

A {

FONT-WEIGHT: 400; FONT-SIZE: 13px; COLOR: black; TEXT-DECORATION: none

}

A:hover {

FONT-WEIGHT: 400; FONT-SIZE: 13px; COLOR: red; TEXT-DECORATION: underline

}

A:active {

FONT: 9pt "宋体"; CURSOR: hand; COLOR: #ff0033

}

</style>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

</head>

<body>

<script>

function show(tips,flag,url){

var my_tips=document.all.mytips;

if(flag){

my_tips.style.display="";

if (url!=null){my_tips.innerHTML="<img src='"+url+"'align=left>"+tips;}

else{ my_tips.innerHTML=tips;}

my_tips.style.left=event.clientX+10;

my_tips.style.top=event.clientY+10;

}

else

{

my_tips.style.display="none";

}

}

</script>

<a href="#" tips="自定义提示" onmousemove=show(this.tips,1) onmouseout=show(this.tips,0)>测试链接</a>

<a href="#" tips="又一个自定义提示" onmousemove=show(this.tips,1,'/Article/UploadFiles/200447114017734.gif') onmouseout=show(this.tips,0)>测试链接</a>

<a href="#" tips="中华人民共和国中华人民共和国自定义提示" onmousemove=show(this.tips,1,'/Article/UploadFiles/200447114018580.gif') onmouseout=show(this.tips,0)>测试链接</a>

<div id=mytips style="position:absolute;width:150;height:16;border:1 gray solid;font-size:9pt;background-color:#ffffff;color:red;display:none;filter: progid:DXImageTransform.Microsoft.Shadow(color=#999999,direction=135,strength=3);">

</div>

</body>

</html>

运行代码框

<html>

<head>

<script Language="javascript">

//***********默认设置定义.*********************

tPopWait=50;//停留tWait豪秒后显示提示。

tPopShow=5000;//显示tShow豪秒后关闭提示

showPopStep=20;

popOpacity=99;

//***************内部变量定义*****************

sPop=null;

curShow=null;

tFadeOut=null;

tFadeIn=null;

tFadeWaiting=null;

document.write("<style type='text/css'id='defaultPopStyle'>");

document.write(".cPopText { background-color: #F8F8F5;color:#000000; border: 1px #000000 solid;font-color: font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");

document.write("</style>");

document.write("<div id='dypopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");

function showPopupText(){

var o=event.srcElement;

MouseX=event.x;

MouseY=event.y;

if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};

if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};

if(o.dypop!=sPop) {

sPop=o.dypop;

clearTimeout(curShow);

clearTimeout(tFadeOut);

clearTimeout(tFadeIn);

clearTimeout(tFadeWaiting);

if(sPop==null || sPop=="") {

dypopLayer.innerHTML="";

dypopLayer.style.filter="Alpha()";

dypopLayer.filters.Alpha.opacity=0;

}

else {

if(o.dyclass!=null) popStyle=o.dyclass

else popStyle="cPopText";

curShow=setTimeout("showIt()",tPopWait);

}

}

}

function showIt(){

dypopLayer.className=popStyle;

dypopLayer.innerHTML=sPop;

popWidth=dypopLayer.clientWidth;

popHeight=dypopLayer.clientHeight;

if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24

else popLeftAdjust=0;

if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24

else popTopAdjust=0;

dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;

dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;

dypopLayer.style.filter="Alpha(Opacity=0)";

fadeOut();

}

function fadeOut(){

if(dypopLayer.filters.Alpha.opacity<popOpacity) {

dypopLayer.filters.Alpha.opacity+=showPopStep;

tFadeOut=setTimeout("fadeOut()",1);

}

else {

dypopLayer.filters.Alpha.opacity=popOpacity;

tFadeWaiting=setTimeout("fadeIn()",tPopShow);

}

}

function fadeIn(){

if(dypopLayer.filters.Alpha.opacity>0) {

dypopLayer.filters.Alpha.opacity-=1;

tFadeIn=setTimeout("fadeIn()",1);

}

}

document.onmouseover=showPopupText;

</script>

</head>

<BODY>

<a href="#" title="我想请问斑竹?<br>作者:农民<br>发表于2002-6-3 20:17:16<br>最后跟贴:呵呵,是住我们......">我想请问斑竹?</a>

接着前面的

</body>

</html>

运行代码框

<a href="#" title="蓝色理想">www.blueidea.com</a>

<img src=/logo.gif alt="www.blueidea.com">

由js控制的代码,还可以临时解决 alt 显示速度慢的问题

运行代码框

<SCRIPT language=javascript1.2>

<!--

tPopWait=50;

tPopShow=50000;

showPopStep=10;

popOpacity=100;

sPop=null;

curShow=null;

tFadeOut=null;

tFadeIn=null;

tFadeWaiting=null;

document.write("<style type='text/css'id='defaultPopStyle'>");

document.write(".cPopText { background-color: #FFFFFF; border: 1px #000000 solid; font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");

document.write("</style>");

document.write("<div id='dypopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");

function showPopupText(){

var o=event.srcElement;

MouseX=event.x;

MouseY=event.y;

if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};

if(o.dypop!=sPop) {

sPop=o.dypop;

clearTimeout(curShow);

clearTimeout(tFadeOut);

clearTimeout(tFadeIn);

clearTimeout(tFadeWaiting);

if(sPop==null || sPop=="") {

dypopLayer.innerHTML="";

dypopLayer.style.filter="Alpha()";

dypopLayer.filters.Alpha.opacity=0;

}

else {

if(o.dyclass!=null) popStyle=o.dyclass

else popStyle="cPopText";

curShow=setTimeout("showIt()",tPopWait);

}

}

}

function showIt(){

dypopLayer.className=popStyle;

dypopLayer.innerHTML=sPop;

popWidth=dypopLayer.clientWidth;

popHeight=dypopLayer.clientHeight;

if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24

else popLeftAdjust=0;

if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24

else popTopAdjust=0;

dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;

dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;

dypopLayer.style.filter="Alpha(Opacity=0)";

fadeOut();

}

function fadeOut(){

if(dypopLayer.filters.Alpha.opacity<popOpacity) {

dypopLayer.filters.Alpha.opacity+=showPopStep;

tFadeOut=setTimeout("fadeOut()",1);

}

else {

dypopLayer.filters.Alpha.opacity=popOpacity;

tFadeWaiting=setTimeout("fadeIn()",tPopShow);

}

}

function fadeIn(){

if(dypopLayer.filters.Alpha.opacity>0) {

dypopLayer.filters.Alpha.opacity-=1;

tFadeIn=setTimeout("fadeIn()",1);

}

}

document.onmouseover=showPopupText;

//-->

</script>

<img src="/Article/UploadFiles/200447114018621.gif" alt="blue!dea welcome you">

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有