一个select的很多options,需要在鼠标经过这些options时,能够取到Options的值。不是要实现title=""的效果。而是要取到值。多谢。

解决方案 »

  1.   

    这个超高难度,因为options不响应onmouseover事件
      

  2.   

    听说用jQuery可以实现。不知道是吗
      

  3.   

    不光onmouseover不行,就连用键盘的上箭头和下箭头来改变选项。也没法触发onchange事件,必须回车才能触发onchange,到底符合才能在鼠标经过某options或者键盘操作(上下箭头)移动到某options时(无需回车)就能触发一个事件。来取得options的值呢
      

  4.   


    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>无标题文档</title>
        <script type="text/javascript">
           function testSel(event){
            var tempDiv = document.getElementById("temp1");
            event= window.event||event;
           // alert(event);
           var targetEl = event.srcElement||event.target ;
           //alert(targetEl.tagName)
            if(targetEl.tagName.toLowerCase()=='option')
                tempDiv.innerHTML = targetEl.value; 
        }
        </script>
    </head><body>
    <select id="testSelect" onmousemove="testSel(event)" >
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
    </select>
    <div id="temp1" style="border:solid 1px red;"></div>
    </body>
    </html>
      

  5.   

    你采用div模仿的select吧,真的select不支持