http://www.csdn.net/expert/topic/802/802480.xml?temp=.4789545要先disabled了才能显示title。
其实selected的文本本来就能看得见啊。

解决方案 »

  1.   

    噢,是不是限制了宽度造成显示不完全啊,试试下面的:<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title></title>
    </head>
    <body><select onmouseout="hideTitle()" style="width:100" onmousemove="showTitle()">
    <option>aaaaaaaaaaaaaaaaaaaaaaaaaaa</option>
    <option>bbbbbbbbbbbbbbbbbbbbbbbbbbb</option>
    <option>ccccccccccccccccccccccccccc</option>
    </select>
    <select onmouseout="hideTitle()" style="width:100" onmousemove="showTitle()">
    <option>111111111111111111111111</option>
    <option>22222222222222222222222</option>
    <option>33333333333333333333333333</option>
    </select><span style="display:none;position:absolute;background-color=#F8F9DF;" id=titleSpan></span>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function showTitle()
    {
    var elm = event.srcElement;
    titleSpan.innerText = elm.options[elm.selectedIndex].text;
    titleSpan.style.top=event.y+20
    titleSpan.style.left=event.x+20
    titleSpan.style.display="";
    }
    function hideTitle()
    {
    titleSpan.style.display="none";
    }
    //-->
    </SCRIPT>
    </body>
    </html>
      

  2.   

    不知道span的style.border对象为什么没有用,只好用table来做边框了,同时调了一下颜色和字体,这回看起来更像title了呵呵。
    实际的title处理的是onmouseover事件,我故意用了onmousemove是因为个人爱好。<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title></title>
    </head>
    <body><select onmouseout="hideTitle()" style="width:100" onmousemove="showTitle()">
    <option>aaaaaaaaaaaaaaaaaaaaaaaaaaa</option>
    <option>bbbbbbbbbbbbbbbbbbbbbbbbbbb</option>
    <option>ccccccccccccccccccccccccccc</option>
    </select>
    <select onmouseout="hideTitle()" style="width:100" onmousemove="showTitle()">
    <option>111111111111111111111111</option>
    <option>22222222222222222222222</option>
    <option>33333333333333333333333333</option>
    </select><table style="display:none;position:absolute;font-size:14" id=titleTable bgcolor=black cellspacing=1><td bgcolor=#FAFBEA></td></table>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function showTitle()
    {
    var elm = event.srcElement;
    titleTable.firstChild.firstChild.firstChild.innerText = elm.options[elm.selectedIndex].text;
    titleTable.style.top=event.y+20
    titleTable.style.left=event.x
    titleTable.style.display="";
    }
    function hideTitle()
    {
    titleTable.style.display="none";
    }
    //-->
    </SCRIPT>
    </body>
    </html>