vitascl 发表于 2007-12-22 16:12

js 下拉框 onmouseover onmousemove !!

为什么option 里无法捕获onmouseover onmousemove 等事件呢????

j2ee126 发表于 2007-12-22 16:48

也可以,比如:
<select>
  <option id="ww1" onmousemove="kk1()">q1</option>
  <option id="ww2" onclick="kk2()">q2</option>
</select>
<a href="#" onclick="ll8()">显示</a>
<script language="javascript">
function kk1(){
   alert("q1");
}
function kk2(){
   alert("q2");
}
function ll8(){
  document.getElementById("ww2").click();
  document.getElementById("ww1").onmousemove();
}
</script>

j2ee126 发表于 2007-12-22 16:51

是间接触发,不是直接触发!!

vitascl 发表于 2007-12-22 17:09

select  style="width:100px"我是定了的 但是里面有的item超出了这个长度无法全部显示出来 所以我写了
function showTitleDiv(obj, content)
    {   
     var divObj = document.getElementById('titleDiv');
    divObj.style.display = 'block';
    divObj.style.top = obj.offsetTop;
    divObj.style.left = obj.offsetLeft;
   divObj.innerHTML = content;
    }

<select class="textinput" onchange="showList1(this.options[this.options.selectedIndex].value)" name="first" style="width:170px">      
<%Iterator it = new LinkMenuDAO().getMenu();
while(it.hasNext()){
Object gwmc =it.next();
if(gwmc != null)
out.println("<option value='"+gwmc+"' onmouseover='showTitleDiv(this, \""+gwmc+"\");'>"+gwmc+"</option>");
}%>
</select>
但是option里捕获不到onmouseover

vitascl 发表于 2007-12-22 17:11

还少了个
<div id="titleDiv" style="position:absolute;display:none;"></div>

vitascl 发表于 2007-12-22 17:12

我是想弄一个浮动的div 方法写好了但是option捕获不到onmouseover

j2ee126 发表于 2007-12-22 17:18

你这样是直接触发,我试过,不知道为什么不能触发事件;期待高手解决................................... 对不起,帮不上了[em04] [em04]

vitascl 发表于 2007-12-22 17:21

我在网上苦苦的找 也问了我周围的人 没一个知道的 网上倒是有问同样问题的 可是没解决

vitascl 发表于 2007-12-22 17:22

哪位高人能指点迷经啊!!!!!!

渚薰 发表于 2007-12-24 13:47

无法触发就是无法触发的~~~~
死抱着也没用的~~~
另寻蹊径吧~~~

vitascl 发表于 2007-12-24 15:18

IE不可以 firefox可以 我日

渚薰 发表于 2007-12-24 17:49

lz请你在任何回帖中,不要出粗口,谢谢

vitascl 发表于 2007-12-24 18:05

抱歉

vitascl 发表于 2007-12-25 14:07

谁能给个解决方案啊

ivan_070 发表于 2008-3-30 11:10

给option设置个属性,捕捉document的move事件判断。

页: [1]

编程论坛