1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

自定义title样式

本帖由 greatqsh2005-10-28 发布。版面名称:前端开发

  1. greatqsh

    greatqsh New Member

    注册:
    2005-09-16
    帖子:
    142
    赞:
    1
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>自定义title - 51windows.net</title>
    </head>
    <body>
    <p><B>自定义title</B>(IE):把鼠标放在下面的文字上查看效果</p>
    <span title="Javascript" title="">默认效果</span><br><br>
    <span title="<marquee style='width:100px;'>www.51windows.net</marquee>" altbg="red" altcolor="yellow" altborder="yellow">滚动字幕</span><br><br>
    <span title="<img src='http://www.51windows.net/51windows.net.logo.gif' border='0'>" altbg="#F7F7F7" altcolor="#999999" altborder="#CCCCCC">图片</span><br><br>
    <span title="<i style='font-size:24pt;font-family:verdana;'>www.51windows.net</i>" altbg="green" altcolor="yellow" 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.onmousemove=quickalt;
    document.body.onmouseover=getalt;
    document.body.onmouseout=restorealt;
    var tempalt='';
    function getalt(){
    if(event.srcElement.title && (event.srcElement.title!='' || (event.srcElement.title=='' && tempalt!=''))){
    altlayer.style.left=event.x;
    altlayer.style.top=event.y+20;
    altlayer.style.display='';
    tempalt=event.srcElement.title;
    tempbg=event.srcElement.altbg;
    tempcolor=event.srcElement.altcolor;
    tempborder=event.srcElement.altborder;
    event.srcElement.title='';
    altlayer.innerHTML=tempalt;
    if (typeof(tempbg)!="undefined"){altlayer.style.background=tempbg}else{altlayer.style.background="infobackground"}
    if (typeof(tempcolor)!="undefined"){altlayer.style.color=tempcolor}else{altlayer.style.color=tempcolor="infotext"}
    if (typeof(tempborder)!="undefined"){altlayer.style.border='1px solid '+tempborder;}else{altlayer.style.border='1px solid #000000';}
    }
    }
    function quickalt(){
    if(altlayer.style.display==''){
    altlayer.style.left=event.x;
    altlayer.style.top=event.y+10;
    }
    }
    function restorealt(){
    event.srcElement.title=tempalt;
    tempalt='';
    altlayer.style.display='none';
    }
    //-->
    </SCRIPT>
    </body>
    </html>
     
  2. jcking

    jcking Well-Known Member

    注册:
    2005-08-30
    帖子:
    22,282
    赞:
    70
    哦,谢谢,