没明白你意思,这是我的代码<script type="text/javascript">
     $(function(){
     $(".txt").focus(function(){
     $(".tip").show();
     });
     $(".tip").click(function(){
     $(this).hide();
     });
     });
    </script>

解决方案 »

  1.   

    然后在第二个事件里加$(".txt").focus()就变成了两个事件不断循环交替的情况
      

  2.   

    没明白你意思,这是我的代码<script type="text/javascript">
         $(function(){
         $(".txt").focus(function(){
         $(".tip").show();
         });
         $(".tip").click(function(){
         $(this).hide();
         });
         });
        </script>
      

  3.   

    你的tip不要用遮盖层这种的。。要不你点击遮盖层上的按钮就会失去焦点了
      

  4.   

    要不你就要自己控制焦点了
            $(function(){
    var txtfocus=false;
                $(".txt").focus(function(){
    if(!txtfocus){//blur后获取到焦点再显示tip
    txtfocus=true
                    $(".tip").show();
    }
                }).blur(function(){txtfocus=false});
                $(".tip").click(function(){
                    $(this).hide();
    if(txtfocus)$(".txt").focus();//txt获取焦点后弹出tip,点击tip后设置回焦点
                });
            });
     
      

  5.   

    太感谢了,不过你这里txtfocus=false}好像是少写了一个等号,加上之后就可以了,总之非常感谢
    http://bbs.csdn.net/topics/390830247
    这是相同的问题,你回答一下我把分给你