日期:2014-05-17  浏览次数:20378 次

为什么选择checkbox后没有对text起到控制作用?
xml代码:
<?xml version="1.0" encoding="utf-8" ?>
<flow>
  <step>
  <ID>01101</ID>
  <name>项目</name>
  </step>
  <step>
  <ID>01102</ID>
  <name>项目21</name>
  </step>
  <step>
  <ID>02101</ID>
  <name>项目22</name>
  </step>
  <step>
  <ID>02102</ID>
  <name>项目23</name>
  </step>
  <step>
  <ID>01103</ID>
  <name>项目3</name>
  </step>
  <step>
  <ID>01104</ID>
  <name>项目4</name>
  </step>
  <step>
  <ID>01105</ID>
  <name>项目5</name>
  </step>
  <step>
  <ID>01106</ID>
  <name>项目6</name>
  </step>
</flow>

html代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
  <script type="text/javascript">//当checkbox选中的时候text编辑框可以编辑,反之不可编辑
  $(document).ready(function () {
  $(".chk").each(function (i, j) {
  $(j).click(function () {
  if ($(this).attr("checked"))
  $(this).next().attr("disabled", "");
  else
  $(this).next().attr("disabled", "disabled");
  });
  });
});
  </script>
<html xmlns="http://www.w3.org/1999/xhtml">
   
  <head>  
  <title> book1.xml display </title>  
  </head>  
  <body>  
  <xml id="dso2" src="book1.xml"></xml>  
  <table datasrc="#dso2" border="1">
  <thead> <th>步骤选择</th> <th>步骤编号</th> <th>步骤名称</th> <th>是否审批</th>  
  </thead> 
  <tr>
  <td><input type="checkbox" class="chk1" value="11" /></td>
  <td><span datafld="ID"></span></td>
  <td><span datafld="name"></span></td>
  <td><input type="checkbox" class="chk" /><input type="text" />
  </td>
  </tr>
  </table>
  </body>
</html>
我读取xml里的数据后checkbox就不能对text进行控制了,请路过的朋友指点一下,多谢!!!
如果把这一行<td><input