????checked???
??????????????е????????????????????????????????????????Щ???????????????????У?????????е??????????????????????????????
????????????????е?????????????????????ū??????????????????д???????????·????????·?????в?????????????????????????????????????????????????????????
?????????????????????????????????????????????????洫????????ú?????????????????????????????棬??????window.open????????????????????????????е???У?ztree????????API?????????????????????otherparm????????????????????????????????????????value??????????js???????????????????????????????????????????????£?

 

<SCRIPT type="text/javascript">
var setting = {
check: {
enable: true??
chkStyle: "checkbox"??
chkboxType : { "Y" : ""?? "N" : "" }
}??
//???json????
async : {
enable : true??
url : "http://127.0.0.1:8080/contact/resource.do?method=getzTreeNodes"?? // Ajax ???????? URL ???
autoParam : [ "id"?? "name" ]?? //ajax?????????????id?
otherParam: ["contactid"??function(){
return window.opener.document.getElementById("contactid").value;
}]
}??
data:{ // ???????data
simpleData : {
enable : true??
idKey : "id"?? // id???????
pIdKey : "pId"?? // ??id???????
rootId : 0
}
}??
// ???????
callback : {
onClick : function(event?? treeId?? treeNode?? clickFlag) {
if(true) {
alert(" ???id???" + treeNode.id + "?? ?????????" + treeNode.name);
}
}??
//?????????????????????????????? ?? ???????????
onAsyncSuccess : function(event?? treeId?? treeNode?? msg){
//  alert("???ó????");
//var nodes=getCheckedNodes(true));
//alert(nodes);
}??
beforeClick: beforeClick??
onCheck: onCheck
}
};
function beforeClick(treeId?? treeNode) {
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
zTree.checkNode(treeNode?? !treeNode.checked?? null?? true);
return false;
}
var code;
function showCode(str) {
if (!code) code = $("#code");
code.empty();
code.append("<li>"+str+"</li>");
}
$(document).ready(function(){
$.fn.zTree.init($("#treeDemo")?? setting);
//setCheck();
});
function onCheck(e??treeId??treeNode)
{
var zTree = $.fn.zTree.getZTreeObj("treeDemo")??
nodes = zTree.getCheckedNodes(true)??
v = "";
var ids="";
for (var i=0?? l=nodes.length; i<l; i++) {
v += nodes[i].name + "??";
ids+=nodes[i].id+"??";
}
if (ids.length > 0 ) ids = ids.substring(0?? ids.length-1);
alert(ids);
if (v.length > 0 ) v = v.substring(0?? v.length-1);
cityObjIds=window.opener.document.getElementById("cateSelIds").value=ids;
cityObjName=window.opener.document.getElementById("cateSelName").value=v;
}
function getSelectedNodes()
{
var zTree = $.fn.zTree.getZTreeObj("treeDemo")??
nodes = zTree.getCheckedNodes(true)??
v = "";
var ids="";
for (var i=0?? l=nodes.length; i<l; i++) {
v += nodes[i].name + "??";
ids+=nodes[i].id+"??";
}
if (ids.length > 0 ) ids = ids.substring(0?? ids.length-1);
alert(ids);
if (v.length > 0 ) v = v.substring(0?? v.length-1);
//var cityObj = $("#citySel");
//var cityObjIds = $("#citySelIds");
//????????updateContact.jsp??????????
window.opener.document.getElementById("cateSelIds").value=ids;
window.opener.document.getElementById("cateSelName").value=v;
}
function  winClose()
{
window.close();
}
lt;/SCRIPT>