$("<input type='checkbox' value='" + id + "'/>" + id_value).appendTo("div");怎么添加input,没有文本内容
复制代码
- <!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>
- <title></title>
- <script src="../javascript/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
- <script src="../javascript/alert.js" type="text/javascript"></script>
- <script language="javascript" type="text/javascript">
- var pageIndex=1;
- var t = new Date().getTime();
- $.ajax({
- url: "../ajax/?m=getattachment&s=20&p=" + pageIndex + "&t=" + t,
- dataType: 'xml', //这里可以不写,但千万别写text或者html!!!
- timeout: 1000,
- error: function(xml)
- {
- sAlert('Error loading XML document' + xml);
- },
- success: function(xml)
- {
- $('#f1').empty();
- $("list").empty();
- //alert('s' + $(xml).find("T").length);
- $(xml).find("T").each(function()
- {
- var id = $(this).children("id").val(); //取对象
- var id_value = $(this).children("fileName").text(); //取文本
- $("<option value=" + id + ">" + id_value + "</option>").appendTo("#f1");
- // $("<input type='checkbox' value='" + id + "'/>pppp").appendTo('#list');//也不起作用
- $("<input type='checkbox' value='" + id + "'/>" + id_value).appendTo("div");
- //document.getElementById("list").innerHTML += "<input type='checkbox' name='file' value='" + id + "'>" + id_value; //
- });
- }
- });
-
- </script>
- </head>
- <body>
- <select id="f1">
- <option></option>
- </select>
- <div id='list'></div>
- </body>
- </html>
|