利用层显示Title内容

本文介绍了一个使用HTML和JavaScript实现的鼠标悬停显示提示信息的功能。通过自定义的CSS样式和JavaScript代码,可以在鼠标悬停于特定链接上时显示额外的信息,增强了用户体验。

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Title层</title>
<link href="css/blue.css" rel="stylesheet" type="text/css">
<style  type="text/css">
<!--
a
{
    font-size
:12px;
    font-family
: Tahoma;
    text-decoration
: none;
}

a:hover 
{
    text-decoration
:underline;
}

-->
</style>
<script language=JavaScript>
var isIE  =  document.all?true:false;  
function overlib(tipcontent)
{
    
    customdiv 
= document.getElementById("overDiv");
    customdiv.innerHTML 
= "<table width=150><tr><td>"+tipcontent+"</td></tr></table>";
    
    
var tleft=document.body.scrollLeft+window.event.clientX;
    
var ttop=document.body.scrollTop+window.event.clientY;
    
if(document.body.clientWidth < 300)
    
{
        customdiv.style.left 
= 2;
    }

    
else if (tleft > document.body.clientWidth-200)
    
{
        customdiv.style.left 
= tleft-175;
    }

    
else
    
{
        customdiv.style.left 
= tleft + 10;
    }

    
if(document.body.clientHeight < 100)
    
{
        customdiv.style.top 
= 25;
    }

    
else if(ttop > document.body.clientHeight -55)
    
{
        customdiv.style.top 
= ttop - 55;
    }

    
else
    
{
        customdiv.style.top 
= ttop + 10;
    }

    customdiv.style.visibility    
= 'visible';
    
}

function nd()
{
    customdiv 
= document.getElementById("overDiv");
    customdiv.style.visibility    
= 'hidden';
}


function b(v){window.status=v};
</script>
</head>
<body>
<div id="overDiv" style="position:absolute; visibility:hidden;border:1px solid #E3E3E3;z-index:1000;padding:2px;background:#FDFEF9;text-align:left;font-size:12px;"></div>    
<div class="jingpaibBox" style=width:320px>
  
<class="titurl" style=width:49%><href='#'  onMouseOver="return overlib('链接一内容...<br><font color=#3E82CD>http://www.hlj.net</font>');" onMouseOut="return nd();"  target=_blank >链接一</a></p>
  
<class="titurl" style=width:49%><href='#'  onMouseOver="return overlib('链接二内容...<br><font color=#3E82CD>http://www.hlj.net</font>');" onMouseOut="return nd();"  target=_blank >链接二</a></p>
</div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值