mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 23:29:31 +01:00
314 lines
65 KiB
HTML
314 lines
65 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
<head>
|
|
<title>Menu Items Manipulations</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
<meta name="title" content="Samples" />
|
|
<meta name="keywords" content="" />
|
|
<meta name="description" content="" />
|
|
<link rel="icon" href="../common/favicon.ico" type="image/x-icon" />
|
|
<link rel="shortcut icon" href="../common/favicon.ico" type="image/x-icon" />
|
|
<link rel="stylesheet" href="../common/css/style.css" type="text/css" media="screen" />
|
|
|
|
</head>
|
|
<body onload="initMenu();">
|
|
<div class="header">
|
|
<a class="logo" href="http://www.dhtmlx.com" title="DHTMLX homepage"></a>
|
|
<div class="tittle-dhtmlx">DHTMLX Docs & Samples Explorer</div>
|
|
<div class="search-field">
|
|
<form action="http://docs.dhtmlx.com/doku.php" accept-charset="utf-8" id="dw__search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" title="Search" /><input class="button" type="submit" value=""><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form>
|
|
</div>
|
|
<div class="buttons">
|
|
<a class="doc_inact" href="../../../docsExplorer/index.html" title="DHTMLX Documentation homepage"></a>
|
|
<a class="sample"></a>
|
|
</div>
|
|
</div>
|
|
<div class="content">
|
|
<div class="navigation-div">
|
|
<a href="../../../docsExplorer/samples.html" class="navigation"><img src="../common/icons/file.gif" alt="" >All components</a>
|
|
<div class="arrow"></div>
|
|
<a href="../index.html" class="navigation"><img height="22" src="../common/icons/menu.gif" alt="" >dhtmlxMenu</a>
|
|
<div class="arrow"></div>
|
|
<a href="./index.html" class="navigation"><img src="../common/icons/none.gif" alt="" >Items</a>
|
|
</div>
|
|
<div style="display:block;">
|
|
<h3>Menu Items Manipulations</h3>
|
|
</div>
|
|
<div class="navigation-div">
|
|
<a href="#code" class="navigation view-source"><img src="../common/icons/source.gif" alt="" >View page source</a>
|
|
</div>
|
|
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxmenu_dhx_skyblue.css">
|
|
<script src="../../codebase/dhtmlxcommon.js"></script>
|
|
<script src="../../codebase/dhtmlxmenu.js"></script>
|
|
<script src="../../codebase/ext/dhtmlxmenu_ext.js"></script>
|
|
|
|
|
|
<div style="height: 250px;"><div id="menuObj"></div></div>
|
|
<div>
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
<td valign="top">
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
<th colspan="3" style="padding-bottom: 10px;">Add New Item</th>
|
|
<tr>
|
|
<td>Item Type</td>
|
|
<td width="10"> </td>
|
|
<td><select id="add_type"><option value="0">Child</option><option value="1">Sibling</option></select></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Parent</td>
|
|
<td> </td>
|
|
<td><div id="item_parent" style="font-weight: bold;">(Click menu to select)</div></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Item Text</td>
|
|
<td> </td>
|
|
<td><input id="item_text" type="text" value=""></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Item Has Icon</td>
|
|
<td> </td>
|
|
<td>
|
|
<span><input id="icon_exists" type="checkbox" checked></span>
|
|
<span><img id="icon_src" width="18" height="18" border="0" src="../common/imgs/copy.gif"></span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Icon Source</td>
|
|
<td> </td>
|
|
<td>
|
|
<span><img onclick="changeIcon(this, 'copy');" width="18" height="18" border="0" src="../common/imgs/copy.gif"></span>
|
|
<span><img onclick="changeIcon(this, 'cut');" width="18" height="18" border="0" src="../common/imgs/cut.gif"></span>
|
|
<span><img onclick="changeIcon(this, 'new');" width="18" height="18" border="0" src="../common/imgs/new.gif"></span>
|
|
<span><img onclick="changeIcon(this, 'paste');" width="18" height="18" border="0" src="../common/imgs/paste.gif"></span>
|
|
<span><img onclick="changeIcon(this, 'print');" width="18" height="18" border="0" src="../common/imgs/print.gif"></span>
|
|
<span><img onclick="changeIcon(this, 'redo');" width="18" height="18" border="0" src="../common/imgs/redo.gif"></span>
|
|
<span><img onclick="changeIcon(this, 'undo');" width="18" height="18" border="0" src="../common/imgs/undo.gif"></span>
|
|
<span><img onclick="changeIcon(this, 'save');" width="18" height="18" border="0" src="../common/imgs/save.gif"></span>
|
|
<span><img onclick="changeIcon(this, 'select_all');" width="18" height="18" border="0" src="../common/imgs/select_all.gif"></span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td> </td>
|
|
<td> </td>
|
|
<td><input type="button" value="Add Item" style="margin-top: 10px;" onclick="addItem();"></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td width="30"> </td>
|
|
<td valign="top">
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
<th colspan="3" style="padding-bottom: 10px;">Remove Item</th>
|
|
<tr>
|
|
<td>Item</td>
|
|
<td> </td>
|
|
<td><div id="item_id" style="font-weight: bold;">(Click menu to select)</div></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" align="center"><input type="button" value="Remove Item" style="margin-top: 10px;" onclick="removeItem();"></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<br>
|
|
|
|
<script>
|
|
var menu;
|
|
function initMenu() {
|
|
menu = new dhtmlXMenuObject("menuObj");
|
|
menu.setIconsPath("../common/imgs/");
|
|
menu.attachEvent("onClick", changeParent);
|
|
menu.loadXML("../common/dhxmenu.xml?e=" + new Date().getTime());
|
|
}
|
|
var itemImg = "copy";
|
|
function changeIcon(obj, icon) {
|
|
document.getElementById("icon_src").src = obj.src;
|
|
itemImg = icon;
|
|
}
|
|
var parentId = null;
|
|
function changeParent(id) {
|
|
parentId = id;
|
|
var text = menu.getItemText(id);
|
|
document.getElementById("item_parent").innerHTML = id + " ("+text+")";
|
|
document.getElementById("item_id").innerHTML = id + " ("+text+")";
|
|
}
|
|
var itemId = 0;
|
|
function addItem() {
|
|
if (parentId == null) { alert("Please select parentId"); return; }
|
|
var itemText = document.getElementById("item_text").value;
|
|
if (itemText.length == 0) { itemText = "New Item"; }
|
|
var img = "";
|
|
var imgDis = "";
|
|
if (document.getElementById("icon_exists").checked) {
|
|
img = itemImg+".gif";
|
|
imgDis = itemImg+"_dis.gif";
|
|
}
|
|
var opts = document.getElementById("add_type");
|
|
if (opts.options[opts.selectedIndex].value == "0") {
|
|
menu.addNewChild(parentId, 0, "item_"+itemId, itemText, false, img, imgDis);
|
|
} else {
|
|
menu.addNewSibling(parentId, "item_"+itemId, itemText, false, img, imgDis);
|
|
}
|
|
itemId++;
|
|
parentId = null;
|
|
document.getElementById("item_parent").innerHTML = "(Click menu to select)";
|
|
document.getElementById("item_id").innerHTML = "(Click menu to select)";
|
|
}
|
|
function removeItem() {
|
|
if (parentId == null) { alert("Please select itemId"); return; }
|
|
menu.removeItem(parentId);
|
|
parentId = null;
|
|
document.getElementById("item_parent").innerHTML = "(Click menu to select)";
|
|
document.getElementById("item_id").innerHTML = "(Click menu to select)";
|
|
}
|
|
</script>
|
|
|
|
|
|
</div>
|
|
<div style="clear:both;"></div>
|
|
<div class="source">
|
|
<div class="teg">Source</div>
|
|
<div class="code" id="code">
|
|
<div class="hl-main"><pre><span class="hl-brackets"><</span><span class="hl-reserved">link</span><span class="hl-code"> </span><span class="hl-var">rel</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">stylesheet</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">text/css</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">href</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../../codebase/skins/dhtmlxmenu_dhx_skyblue.css</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../../codebase/dhtmlxcommon.js</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">script</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../../codebase/dhtmlxmenu.js</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">script</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../../codebase/ext/dhtmlxmenu_ext.js</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">script</span><span class="hl-brackets">></span><span class="hl-code">
|
|
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">style</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">height: 250px;</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">menuObj</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">div</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">div</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">div</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">table</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">cellspacing</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">cellpadding</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-code"> </span><span class="hl-var">valign</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">top</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">table</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">cellspacing</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">cellpadding</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">th</span><span class="hl-code"> </span><span class="hl-var">colspan</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">3</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">style</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">padding-bottom: 10px;</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">Add New Item</span><span class="hl-brackets"></</span><span class="hl-reserved">th</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">Item Type</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">10</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-special">&nbsp;</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">select</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">add_type</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">option</span><span class="hl-code"> </span><span class="hl-var">value</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">Child</span><span class="hl-brackets"></</span><span class="hl-reserved">option</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">option</span><span class="hl-code"> </span><span class="hl-var">value</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">1</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">Sibling</span><span class="hl-brackets"></</span><span class="hl-reserved">option</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">select</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">Parent</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-special">&nbsp;</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">item_parent</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">style</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">font-weight: bold;</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">(Click menu to select)</span><span class="hl-brackets"></</span><span class="hl-reserved">div</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">Item Text</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-special">&nbsp;</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">input</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">item_text</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">text</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">value</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">Item Has Icon</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-special">&nbsp;</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">input</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">icon_exists</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">checkbox</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">checked</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">img</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">icon_src</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/copy.gif</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">Icon Source</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-special">&nbsp;</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">img</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">changeIcon(this, 'copy');</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/copy.gif</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">img</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">changeIcon(this, 'cut');</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/cut.gif</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">img</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">changeIcon(this, 'new');</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/new.gif</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">img</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">changeIcon(this, 'paste');</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/paste.gif</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">img</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">changeIcon(this, 'print');</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/print.gif</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">img</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">changeIcon(this, 'redo');</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/redo.gif</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">img</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">changeIcon(this, 'undo');</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/undo.gif</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">img</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">changeIcon(this, 'save');</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/save.gif</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">img</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">changeIcon(this, 'select_all');</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">18</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/select_all.gif</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">span</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-special">&nbsp;</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-special">&nbsp;</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">input</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">button</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">value</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">Add Item</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">style</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">margin-top: 10px;</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">addItem();</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">table</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">30</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-special">&nbsp;</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-code"> </span><span class="hl-var">valign</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">top</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">table</span><span class="hl-code"> </span><span class="hl-var">border</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">cellspacing</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">cellpadding</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">th</span><span class="hl-code"> </span><span class="hl-var">colspan</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">3</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">style</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">padding-bottom: 10px;</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">Remove Item</span><span class="hl-brackets"></</span><span class="hl-reserved">th</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">Item</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-special">&nbsp;</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">item_id</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">style</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">font-weight: bold;</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-code">(Click menu to select)</span><span class="hl-brackets"></</span><span class="hl-reserved">div</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">td</span><span class="hl-code"> </span><span class="hl-var">colspan</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">3</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">align</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">center</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"><</span><span class="hl-reserved">input</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">button</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">value</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">Remove Item</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">style</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">margin-top: 10px;</span><span class="hl-quotes">"</span><span class="hl-code"> </span><span class="hl-var">onclick</span><span class="hl-code">=</span><span class="hl-quotes">"</span><span class="hl-string">removeItem();</span><span class="hl-quotes">"</span><span class="hl-brackets">></span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">table</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">td</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">tr</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">table</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"></</span><span class="hl-reserved">div</span><span class="hl-brackets">></span><span class="hl-code">
|
|
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">br</span><span class="hl-brackets">></span><span class="hl-code">
|
|
</span><span class="hl-brackets"><</span><span class="hl-reserved">script</span><span class="hl-brackets">></span><span class="hl-code"><div class="hl-main"><pre><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">menu</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">initMenu</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-identifier">menu</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">dhtmlXMenuObject</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">menuObj</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-identifier">menu</span><span class="hl-code">.</span><span class="hl-identifier">setIconsPath</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">../common/imgs/</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-identifier">menu</span><span class="hl-code">.</span><span class="hl-identifier">attachEvent</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">onClick</span><span class="hl-quotes">"</span><span class="hl-code">, </span><span class="hl-identifier">changeParent</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-identifier">menu</span><span class="hl-code">.</span><span class="hl-identifier">loadXML</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">../common/dhxmenu.xml?e=</span><span class="hl-quotes">"</span><span class="hl-code"> + </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-builtin">Date</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">getTime</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span><span class="hl-code">
|
|
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">itemImg</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-string">copy</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">changeIcon</span><span class="hl-brackets">(</span><span class="hl-identifier">obj</span><span class="hl-code">, </span><span class="hl-identifier">icon</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">icon_src</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">src</span><span class="hl-code"> = </span><span class="hl-identifier">obj</span><span class="hl-code">.</span><span class="hl-identifier">src</span><span class="hl-code">;
|
|
</span><span class="hl-identifier">itemImg</span><span class="hl-code"> = </span><span class="hl-identifier">icon</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span><span class="hl-code">
|
|
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">parentId</span><span class="hl-code"> = </span><span class="hl-reserved">null</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">changeParent</span><span class="hl-brackets">(</span><span class="hl-identifier">id</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-identifier">parentId</span><span class="hl-code"> = </span><span class="hl-identifier">id</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">text</span><span class="hl-code"> = </span><span class="hl-identifier">menu</span><span class="hl-code">.</span><span class="hl-identifier">getItemText</span><span class="hl-brackets">(</span><span class="hl-identifier">id</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">item_parent</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">innerHTML</span><span class="hl-code"> = </span><span class="hl-identifier">id</span><span class="hl-code"> + </span><span class="hl-quotes">"</span><span class="hl-string"> (</span><span class="hl-quotes">"</span><span class="hl-code"> + </span><span class="hl-identifier">text</span><span class="hl-code"> + </span><span class="hl-quotes">"</span><span class="hl-string">)</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">item_id</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">innerHTML</span><span class="hl-code"> = </span><span class="hl-identifier">id</span><span class="hl-code"> + </span><span class="hl-quotes">"</span><span class="hl-string"> (</span><span class="hl-quotes">"</span><span class="hl-code"> + </span><span class="hl-identifier">text</span><span class="hl-code"> + </span><span class="hl-quotes">"</span><span class="hl-string">)</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span><span class="hl-code">
|
|
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">itemId</span><span class="hl-code"> = </span><span class="hl-number">0</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">addItem</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">parentId</span><span class="hl-code"> == </span><span class="hl-reserved">null</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-identifier">alert</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">Please select parentId</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">return</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span><span class="hl-code">
|
|
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">itemText</span><span class="hl-code"> = </span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">item_text</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">value</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">itemText</span><span class="hl-code">.</span><span class="hl-identifier">length</span><span class="hl-code"> == </span><span class="hl-number">0</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-identifier">itemText</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-string">New Item</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span><span class="hl-code">
|
|
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">img</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">imgDis</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">icon_exists</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">checked</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-identifier">img</span><span class="hl-code"> = </span><span class="hl-identifier">itemImg</span><span class="hl-code"> + </span><span class="hl-quotes">"</span><span class="hl-string">.gif</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-identifier">imgDis</span><span class="hl-code"> = </span><span class="hl-identifier">itemImg</span><span class="hl-code"> + </span><span class="hl-quotes">"</span><span class="hl-string">_dis.gif</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span><span class="hl-code">
|
|
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">opts</span><span class="hl-code"> = </span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">add_type</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">opts</span><span class="hl-code">.</span><span class="hl-identifier">options</span><span class="hl-brackets">[</span><span class="hl-identifier">opts</span><span class="hl-code">.</span><span class="hl-identifier">selectedIndex</span><span class="hl-brackets">]</span><span class="hl-code">.</span><span class="hl-identifier">value</span><span class="hl-code"> == </span><span class="hl-quotes">"</span><span class="hl-string">0</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-identifier">menu</span><span class="hl-code">.</span><span class="hl-identifier">addNewChild</span><span class="hl-brackets">(</span><span class="hl-identifier">parentId</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-quotes">"</span><span class="hl-string">item_</span><span class="hl-quotes">"</span><span class="hl-code"> + </span><span class="hl-identifier">itemId</span><span class="hl-code">, </span><span class="hl-identifier">itemText</span><span class="hl-code">, </span><span class="hl-reserved">false</span><span class="hl-code">, </span><span class="hl-identifier">img</span><span class="hl-code">, </span><span class="hl-identifier">imgDis</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-reserved">else</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-identifier">menu</span><span class="hl-code">.</span><span class="hl-identifier">addNewSibling</span><span class="hl-brackets">(</span><span class="hl-identifier">parentId</span><span class="hl-code">, </span><span class="hl-quotes">"</span><span class="hl-string">item_</span><span class="hl-quotes">"</span><span class="hl-code"> + </span><span class="hl-identifier">itemId</span><span class="hl-code">, </span><span class="hl-identifier">itemText</span><span class="hl-code">, </span><span class="hl-reserved">false</span><span class="hl-code">, </span><span class="hl-identifier">img</span><span class="hl-code">, </span><span class="hl-identifier">imgDis</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span><span class="hl-code">
|
|
</span><span class="hl-identifier">itemId</span><span class="hl-code">++;
|
|
</span><span class="hl-identifier">parentId</span><span class="hl-code"> = </span><span class="hl-reserved">null</span><span class="hl-code">;
|
|
</span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">item_parent</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">innerHTML</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-string">(Click menu to select)</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">item_id</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">innerHTML</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-string">(Click menu to select)</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span><span class="hl-code">
|
|
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">removeItem</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">parentId</span><span class="hl-code"> == </span><span class="hl-reserved">null</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
|
|
</span><span class="hl-identifier">alert</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">Please select itemId</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-reserved">return</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span><span class="hl-code">
|
|
</span><span class="hl-identifier">menu</span><span class="hl-code">.</span><span class="hl-identifier">removeItem</span><span class="hl-brackets">(</span><span class="hl-identifier">parentId</span><span class="hl-brackets">)</span><span class="hl-code">;
|
|
</span><span class="hl-identifier">parentId</span><span class="hl-code"> = </span><span class="hl-reserved">null</span><span class="hl-code">;
|
|
</span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">item_parent</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">innerHTML</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-string">(Click menu to select)</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">item_id</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">innerHTML</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-string">(Click menu to select)</span><span class="hl-quotes">"</span><span class="hl-code">;
|
|
</span><span class="hl-brackets">}</span></pre></div></span><span class="hl-brackets"></</span><span class="hl-reserved">script</span><span class="hl-brackets">></span></pre></div>
|
|
</div>
|
|
<div class="footer">
|
|
<div class="footer-logo"></div>
|
|
<div class="copyright">Copyright © 1998-2012 DHTMLX LTD.<br />All rights reserved.</div>
|
|
</div>
|
|
</body>
|
|
</html> |