要显示的内容为aasdfadsfasdfasghhhhhhderrrrrrrrrrghhhhh
因为内容比较长,在网页上只显示部分内容。比如aasdfadsfasdfa
当鼠标移动到该位置时弹出个小框框显示全部内容。

解决方案 »

  1.   

    title 很难用,而且无法随意添加样式,使用很不理想!类似问题前两天刚好有人问到,封装了一下L@_@K<!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>
      <title>js.smartTitle</title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="" />
      <meta name="keywords" content="" />
      <meta name="description" content="" />
     </head> <body>
    <input type="text" id="txtHehe" value="把鼠标移上来看看哈" />
    <input type="text" id="txtHaha" value="把鼠标移上来看看哈" />
    <input type="text" id="txtHeihei" title="title 效果!" value="把鼠标移上来看看哈" />
    <div id="divShort" style="width: 89px; overflow: hidden;">aasdfadsfasdfasghhhhhhderrrrrrrrrrghhhhh </div>
     </body>
     <script type="text/javascript">
     <!--
    function AddSmartTitle(sId, innerHTML)
    {
    if (this.TipRegion === undefined) {
    this.TipRegion = document.body.appendChild(document.createElement("div"));
    this.TipRegion.style.padding = "5px 5px 5px 5px";
    this.TipRegion.style.fontSize = "9pt";
    this.TipRegion.style.border = "dotted 1px black";
    this.TipRegion.style.backgroundColor = "#ffffcc";
    this.TipRegion.style.display = "none";
    } var target = document.getElementById(sId);
    if (target) {
    target.TipRegion = this.TipRegion;
    target.onmouseover = function(event) {
    event = event ? event : window.event; this.TipRegion.style.position = "absolute";
    var topDis = (document.documentElement.scrollTop > 0) ? document.documentElement.scrollTop : document.body.scrollTop;
    this.TipRegion.style.top = event.clientY + topDis + "px";
    this.TipRegion.style.left = event.clientX + "px";
    this.TipRegion.style.display = "block"; this.TipRegion.innerHTML = innerHTML;
    }; target.onmouseout = function() {
    this.TipRegion.style.display = "none";
    };
    }
    }AddSmartTitle("txtHehe", "<i style='color: blue'>只有想不到</i>,");
    AddSmartTitle("txtHaha", "<b style='color: red'>没有做不到</b>!<br />——yixianggao");
    AddSmartTitle("divShort", document.getElementById("divShort").innerText);
     //-->
     </script>
    </html>
      

  2.   

    title 适用于简单显示,使用时有延迟,而且偶尔会失效!俺滴 SmartTitle 则灵活滴多,想咋整就咋整,嘿嘿
      

  3.   

    哈,cloudgamer 发滴都是重量级滴东东,俺只封装一些好玩滴小东东