<div class="innerNiceL"> <!--<div class="searchld"> <input type="text" value=""> </div>--> <div class="ie6fixwrap"> <div class="ms-cont-con innerNice_w linkManage" style="height: 255px; _width: 100%; * overflow: auto;"> <div class="innerNice_i"> <div class="ztree_side ztree" id="portalModuleTree"></div> </div> </div> </div> </div> <div class="innerNiceR"> <div class="linkclickcon"> <div class="ie6fixwrap"> <div class="innerNice_w" style="height: 255px; overflow: auto; position: relative; _width: 100%; * overflow: auto;"> <div class="linktradw innerNice_i" id="portalModuleName" style="overflow: auto;"> <ul id="selectedModule"> </ul> </div> <input type="hidden" id="portalModuleId" value="" /> </div> </div> </div> </div> </div> </div> <div class="diabot f-tac diabot_pad_1"> <span class="btns btn-blue2"><i><input type="button" onclick="saveRoleModule()" value="确定"> </i> </span> <span class="btns btn-blue2"><i><input type="button" value="取消" onclick="closeDialog()" /> </i> </span> </div> </div> </div>
var moduleNames;//选中的角色原有的模块名称; var moduleIds; //选择的角色原有的模块id; var moduleName = new Array();//存放要关联的模块名称; var moduleId = new Array(); //存放要关联的模块的id; //点击树右边出现被点击的元素并实现对右边该元素的操作 function treeOnClick(event, treeId, treeNode){ console.info(treeNode); // document.getElementById("#mid").text(mname)=""; //清空 var mid = treeNode.id; var mname = treeNode.name; if(treeNode.children && treeNode.children.length != 0) { return; } if($("#"+mid).size()==0) { var ul = $("#selectedModule"); var li = $("<li id='" + mid + "'></li>"); var span = $("<span></span>").addClass("addItems"); var a = $("<a></a>").addClass("delete").attr("href", "javaScript:void(0)").css("display", "block"); a.on("click", function() { $(this).parent().parent().remove(); }); span.append(a).append($("<span></span>").text(mname)); li.append(span);
ul.append(li); } else { alert(mname + "已添加"); }
给个可行例子提示一下也是可以的,自己写的 运行到这里 下面的不走了