+ -
当前位置:首页 → 问答吧 → 怎么添加inupt控件

怎么添加inupt控件

时间:2009-08-18

来源:互联网



$("<input type='checkbox' value='" + id + "'/>" + id_value).appendTo("div");怎么添加input,没有文本内容


复制代码
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.     <title></title>
  5. <script src="../javascript/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  6. <script src="../javascript/alert.js" type="text/javascript"></script>
  7. <script language="javascript" type="text/javascript">
  8. var pageIndex=1;
  9. var t = new Date().getTime();
  10. $.ajax({
  11.     url: "../ajax/?m=getattachment&s=20&p=" + pageIndex + "&t=" + t,
  12.     dataType: 'xml', //这里可以不写,但千万别写text或者html!!!
  13.     timeout: 1000,
  14.     error: function(xml)
  15.     {
  16.         sAlert('Error loading XML document' + xml);
  17.     },
  18.     success: function(xml)
  19.     {
  20.         $('#f1').empty();
  21.         $("list").empty();
  22.         //alert('s' + $(xml).find("T").length);
  23.         $(xml).find("T").each(function()
  24.         {
  25.             var id = $(this).children("id").val(); //取对象
  26.             var id_value = $(this).children("fileName").text(); //取文本
  27.             $("<option value=" + id + ">" + id_value + "</option>").appendTo("#f1");
  28.            // $("<input type='checkbox' value='" + id + "'/>pppp").appendTo('#list');//也不起作用
  29.      $("<input type='checkbox' value='" + id + "'/>" + id_value).appendTo("div");
  30.             //document.getElementById("list").innerHTML += "<input type='checkbox' name='file' value='" + id + "'>" + id_value;  //
  31.         });
  32.     }
  33. });
  34.     
  35. </script>
  36. </head>
  37. <body>
  38.     <select id="f1">
  39.         <option></option>        
  40.     </select>
  41.    <div id='list'></div>
  42. </body>
  43. </html>

作者: rovedog   发布时间: 2009-08-18