选中复选框

  <script language=javascript>
      $(document).ready(function() {
          if ($("#HiddenField1").val() != null && $("#HiddenField1").val() != "") {
              var strArray = [];
              var strVal = $("#HiddenField1").val();
              strArray = strVal.split(',');
              for (var i = 0; i < strArray.length; i++) {
                  try {
                      $("input[value='" + strArray[i] + "']").attr("checked", "checked");
                  } catch (e) { }
              }
          }
      })
  </script>

  

posted @ 2012-11-14 16:07  xyzhuzhou  阅读(208)  评论(0编辑  收藏  举报