自定义Title

来源:http://hi.baidu.com/adverse/blog/item/b1cc9758b416eddf9c8204c7.html

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>自定义Title</title>
</head>
<body >
<p><B>自定义Title</B>(IE & FireFox...):把鼠标放在下面的文字上查看效果</p>
<span title="Javascript" title="">默认效果</span><br><br>
<span title="<marquee style='width:60px;'>www.azhong.com</marquee>" altbg="red" altcolor="yellow" altborder="yellow">滚动字幕</span><br><br>
<span title="<img src='http://www.azhong.com/azhong.com.logo.gif' border='0'>" altbg="#F7F7F7" altcolor="#999999" altborder="#CCCCCC">图片</span><br><br>
<span title="<i style='font-size:18pt;font-family:verdana;'>welcome to <font color='yellow'>www.azhong.com</font></i>" altbg="green" altcolor="black" altborder="darkgreen">大字体大字体大字体大字体大字体大字体大字体大字体大字体大字体大字体大字体大字体大字体大字体大字体大字体大字体大字体</span><br><br>
<div style="display:none;border:1px solid #000000;background-color:#FFFFCC;font-size:12px;position:absolute;padding:2;" id="_altlayer"></div>
<SCRIPT LANGUAGE="JavaScript">
<!--
document.body.οnmοusemοve=quickalt;
document.body.οnmοuseοver=getalt;
document.body.οnmοuseοut=restorealt;
var tempalt='';

var UA=navigator.userAgent.toLowerCase();
var ISIE=(UA.indexOf("msie") > 0);
function $(hw_){return document.getElementById(hw_);}

function _Move(evn,o){
     _bW=document.body.clientWidth;
     _left1=document.body.scrollLeft+evn.clientX+10;
     _oW=o.offsetWidth;
     _left=((evn.clientX+_oW)>_bW)?(_left1-_oW-10):_left1;
     if((evn.clientX+_oW)>_bW){_left=(_oW<evn.clientX)?(_left1-_oW-10):_left1;}

     _bH=document.body.clientHeight;
     _top1=document.body.scrollTop+evn.clientY+6;
     _oH=o.offsetHeight;
     _top=((evn.clientY+_oH)>_bH)?(_top1-_oH-6):_top1;
     if((evn.clientY+_oH)>_bH){_top1=(_oH<evn.clientY)?(_top1-_oH-6):_top1;}
     o.style.left=_left;
     o.style.top=_top;
}

function getalt(hw_){
     if(ISIE){evn=event}else{evn=hw_}
     var eo = evn.srcElement?evn.srcElement:evn.target;
     if(eo.title && (eo.title!=""|| (eo.title=="" && tempalt!=""))){
         o = $("_altlayer");
         _Move(evn,o);
         o.style.display='';
         tempalt=eo.title;
         tempbg=eo.getAttribute("altbg");
         tempcolor=eo.getAttribute("altcolor");
         tempborder=eo.getAttribute("altborder");
         eo.title='';
         o.innerHTML=tempalt;
         if (tempbg!=null){o.style.background=tempbg}else{o.style.background="infobackground"}
         if (tempcolor!=null){o.style.color=tempcolor}else{o.style.color=tempcolor="infotext"}
         if (tempborder!=null){o.style.border="1px solid "+tempborder;}else{o.style.border="1px solid #000000";}
     }
}
function quickalt(hw_){
     if(ISIE){evn=event}else{evn=hw_}
     o = $("_altlayer");
     if(o.style.display==""){
         _Move(evn,o);
     }
}
function restorealt(hw_){
     if(ISIE){evn=event}else{evn=hw_}
     var eo = evn.srcElement?evn.srcElement:evn.target;
     eo.title=tempalt;
     tempalt="";
     $("_altlayer").style.display="none";
}
//-->
</SCRIPT>

</body>
</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值