提交修改

master
dsh 1 year ago
parent 828469023e
commit 58ea36bb02

@ -26,9 +26,10 @@ function createHttpRequest() {
function buildOptions(xmlDoc,id) { function buildOptions(xmlDoc,id) {
var selectObj = document.getElementById(id); var selectObj = document.getElementById(id);
if (!selectObj || selectObj.tagName!="SELECT") { if (!selectObj || selectObj.tagName!="TR") {
return; return;
} }
var selectObjNew = selectObj.childNodes[3].childNodes[1]
var options = xmlDoc.getElementsByTagName("option"); var options = xmlDoc.getElementsByTagName("option");
//clear select object //clear select object
// for (var i = selectObj.length-1 ; i >= 0 ; i--){ // for (var i = selectObj.length-1 ; i >= 0 ; i--){
@ -38,10 +39,9 @@ function buildOptions(xmlDoc,id) {
for (var i=0; i<options.length; i++) { for (var i=0; i<options.length; i++) {
var len = selectObj.length; var len = selectObj.length;
selectObj.length = len + 1; selectObj.length = len + 1;
selectObj.options[len].value = options[i].attributes[0].nodeValue; selectObjNew.options[len] = new Option(options[i].attributes[1].nodeValue, options[i].attributes[0].nodeValue);
selectObj.options[len].text = options[i].attributes[1].nodeValue;
if (options[i].attributes[2].nodeValue =="selected") { if (options[i].attributes[2].nodeValue =="selected") {
selectObj.options[len].selected = true; selectObjNew.options[len].selected = true;
} }
} }
} }

@ -190,7 +190,7 @@ function saveMenu() {
</td> </td>
</tr> </tr>
<tr height='30' id="submenu"> <tr height='30' id="submenu">
<td class='cell2' width="100"><a href="javascript:addNode('submenuid','0')">增加文件夹</a></td> <td class='cell2' width="100"><a href="javascript:addNode('submenu','0')">增加文件夹</a></td>
<td class='cell2'> <td class='cell2'>
<select name="subMenuid"></select> <select name="subMenuid"></select>
</td> </td>
@ -251,7 +251,7 @@ function setOptions() {
if (xmlObj) { if (xmlObj) {
var options = xmlObj.getElementsByTagName("options"); var options = xmlObj.getElementsByTagName("options");
buildOptions(options[0],"toMenuid"); buildOptions(options[0],"toMenuid");
buildOptions(options[1],"subMenuid"); buildOptions(options[1],"submenu");
buildOptions(options[2],"func"); buildOptions(options[2],"func");
} }
} }
@ -287,10 +287,11 @@ function addNode(objName,type) {
if (upmenuid) { if (upmenuid) {
var menuname="",menuid="",pos=-1; var menuname="",menuid="",pos=-1;
var obj = document.getElementById(objName); var obj = document.getElementById(objName);
for (var i=0; i<obj.length; i++) { var objNew = obj.childNodes[3].childNodes[1]
if (obj[i].selected==true) { for (var i=0; i<objNew.length; i++) {
menuname = obj.options[i].text; if (objNew[i].selected==true) {
menuid = obj.options[i].value; menuname = objNew.options[i].text;
menuid = objNew.options[i].value;
pos = i; pos = i;
break; break;
} }
@ -305,7 +306,7 @@ function addNode(objName,type) {
var menuitem = eval("tree" + upmenuid); var menuitem = eval("tree" + upmenuid);
eval("tree"+menuid+"=new WebFXTreeItem(menuname,\"javascript:oper('"+ menuid +"','"+ menuname +"','"+ upmenuid +"','"+ type +"')\")"); eval("tree"+menuid+"=new WebFXTreeItem(menuname,\"javascript:oper('"+ menuid +"','"+ menuname +"','"+ upmenuid +"','"+ type +"')\")");
menuitem.add(eval("tree"+menuid)); menuitem.add(eval("tree"+menuid));
removeOption(obj,pos); removeOption(objNew,pos);
} else { } else {
alert("请选择一个节点!"); alert("请选择一个节点!");
} }

Loading…
Cancel
Save