$("#a").click(function (){
  $("#a").html("<input id='aa' type='text' value=''>");
  $("#aa").select();
});.select()与.focus()都有相同问题!点击a后插入input获取aa的焦点 正常
但是在单击aa input的时候
ff内容清空 有焦点 
ie内容清空 无焦点向实现内容不清空 不失去焦点!

解决方案 »

  1.   

    你这样写有个问题
    click只能用一次,否则就会有问题<!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" />
    <title>无标题文档</title>
    <script src="js/jquery-1.3.2.min.js"></script>
    </head>
    <body>
    <div id="a" style="width:100px; height:100px; background-color:#063">
    </div>
    </body>
    </html>
    <script language="javascript">
    $(function ()
    {
    $("#a").one("click",a);
    });
    function a()
    {
     $("#a").html("<input id='aa' type='text' value='dfdfdf'>");
     $("#aa")[0].focus(); 
     $("#aa")[0].select(); 
    }
    </script>