我希望在网页上用JS实现这样的效果: 鼠标移动到指定文字上时,会在鼠标后出现浮动的提示信息。就像360安全卫士里面的那种效果一样。我截了一个图可以看一下:
https://pq3nbg.bay.livefilestore.com/y1pkV2uKHM2oZYiWlXycdLw7ZWxNxqIskNtkfiTLK0jQePlbWZ2HXL2ifSiiUGH-LTqKVwkpzlLMr8bvBd368oiWbZz_YCUcQtf/360.JPG
有高手可以帮忙看下吗?给个思路也行。

解决方案 »

  1.   

    图片看不到,给个效果 lz 看看行不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 AppendSmartTip(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";
    };
    }
    }AppendSmartTip("txtHehe", "<i style='color: blue'>只有想不到</i>,");
    AppendSmartTip("txtHaha", "<b style='color: red'>没有做不到</b>!<br />——yixianggao");
    AppendSmartTip("divShort", document.getElementById("divShort").innerText);
     //-->
     </script>
    </html>