问题如下<input id="test" title="<B>test</B>" />我想通过js修改title的值控件.title="<B>ccccc</B>"但是却显示 <B>ccccc</B>通过js控制title的怎么能把样式带进去啊
在线等~~

解决方案 »

  1.   

    晕死!title 里面怎么加样式 啊 
      

  2.   

    四个字,未必没戏!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="把鼠标移上来看看哈" />
     </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 = "13px";
    this.TipRegion.style.border = "solid 1px black";
    this.TipRegion.style.backgroundColor = "#FFFFD5";
    this.TipRegion.style.display = "none";
    } var target = document.getElementById(sId);
    //alert(target);
    if (target) {
    target.TipRegion = this.TipRegion;
    target.onmouseover = function() {
    this.TipRegion.style.position = "absolute";
    this.TipRegion.innerHTML = innerHTML;
    var topDis = (document.documentElement.scrollTop > 0) ? document.documentElement.scrollTop : document.body.scrollTop;
    this.TipRegion.style.top = event.clientY + topDis;
    this.TipRegion.style.left = event.clientX;
    this.TipRegion.style.display = "block"; }; target.onmouseout = function() {
    this.TipRegion.style.display = "none";
    };
    }
    }AddSmartTitle("txtHehe", "<i style='color: blue'>只有想不到</i>,");
    AddSmartTitle("txtHaha", "<b style='color: red'>没有做不到</b>!<br />——yixianggao");
     //-->
     </script>
    </html>
      

  3.   

    修改了一下可以兼容 FF 了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="把鼠标移上来看看哈" />
     </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 = "13px";
    this.TipRegion.style.border = "solid 1px black";
    this.TipRegion.style.backgroundColor = "#FFFFD5";
    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";
    this.TipRegion.innerHTML = innerHTML;
    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";
    }; target.onmouseout = function() {
    this.TipRegion.style.display = "none";
    };
    }
    }AddSmartTitle("txtHehe", "<i style='color: blue'>只有想不到</i>,");
    AddSmartTitle("txtHaha", "<b style='color: red'>没有做不到</b>!<br />——yixianggao");
     //-->
     </script>
    </html>
      

  4.   

    5,6楼的是用层来模拟出的title,标签自带的title是没办法加入样式的!