//这两个都是选择input中被选中的空间,但是在IE中$("#child input:checked")有可能还会选中text控件
$("#child input:checked")
$(\'#child\').find("input[checked=true]")
if (selectradio.length == 0) {
alert("请选择需要查询的表");
return;
}
//选择所有checkbox
$("#datatablename :checkbox")
//遍历table下所有为div的节点
$("#table > div")
//遍历selectdatatables下的最后一个子节点
$("#selectdatatables:last-child")
//遍历td下第二个子节点
$(\'#field #selectdatatables tr td:nth-child(2)\')
//遍历id以td开始的节点
$("#selectdatatables td[id^=\'*td\']")
2:控件属性操作
//给属性赋值
$("#child #" + divval).attr("Showcheck", 1);
//显示空间
$("#table").css("display", "block");
//隐藏控件
$("#table").css("display", "none");
//使控件为只读
$(\'#txtbymachinid\').attr("readonly", true);
//控件为没有选中状态
$(\'#child input:checked\').attr("checked", false);
//控件获得焦点
$(\'#txtbyrodno\').focus();
//判断控件的属性
if($("#table").css("display") == "block")
$(this).attr("Showcheck") == 0
3:常用事件及方法
//给select赋值
<select id="parent" style="width: 100%; float: left"></select>
for (var i = 0; i < a.length; i++) {
$("#parent").append("<option value=\'" + a[i].parentid + "\'>" + a[i].parentname + "</option>");
}
//当select中显示的值改变时触发的事件
$(\'#parent\').change(function () {
loadchild($(\'#parent\').val());
});
//绑定事件,异步会用到
$("#selectdatatables td[id^=\'*td\']").bind("click", function () {
showfield($(this).text(), $(this).attr("id").replace("*td", ""));
});
//同步时触发事件
<a href=\'#\' style=\'text-decoration: none\' onclick=oldquery(this,\'" + savedname + "\')><font color=\'#757F7F\'> 搜索</font></a>
//触发的函数
function fieldDetail(sender, fielddata) {
$(sender).prev().attr("checked", true); //使当前字段前面的checkbox为选中状态
$(sender).prev().attr("disabled", "disabled"); //禁用当前字段前面的checkbox
$(sender).attr("onclick", ""); //禁用当前字段的onclick事件
}