这段代码主要实现点击文本框会弹出个DIV选择框,点击里面的内容能在文本框中显示,代码如下:function a(x,t){
 var t="#"+t;
 $(t).show();
 $(t).find("div").one("click",function(){
 $(x).val( $(this).text());
 $(t).hide();
}<input type="text" onclick="a(this,'d')"><br/>
<div id="d" style="display:none;">
   <div>1</div>
   <div>2</div>
   <div>3</div>
   <div>4</div>
</div>可以在IE和谷歌浏览器里正常使用,在火狐浏览器里$(this)取到的不是点击的这个div...是所有$(t).find("div"),想请教如果要实现上述效果,在火狐中应该怎么做?

解决方案 »

  1.   

    function a(x,t) {
     var t="#"+t;
     $(t).show();
     $(t).find("div").one("click",function(){
     $(x).val($(this).text());
     $(t).hide();
    });
    }
    请严谨你的代码。少了})都是问题~
      

  2.   

    还是不行,我知道为什么了
    我的JS有以下事件
    code=JScript]
     //增加光标移出事件
         $(x).one("blur",function(){
     $(t).hide();
    });
    //增加鼠标悬停在弹出div层上事件,解决滚动条无法滚动
    $(t).hover(
        function(){
          $(x).unbind('blur');
        },
        function(){
           $(x).bind("blur",function(){
           $(t).hide();
           $(x).unbind('blur');
           });
        });[[/code]
    在FF下悬停他只认识悬停在当前的div层,不承认最外层div也是悬停状态 ,所以onblur事件没有解除。现在我在内层悬停解除了onblur正常了。谢谢大家~