How to add an onclick event in xml menu template


I have done some tutorials from the code samples and now I try to add an onlclick event to a menu item which is generated from a xml template. For example I try to add a printToPDF function in the menu but I don’t get it to work. Any ideas? The XML looks like this:


<?xml version="1.0"?> //1st item //1 sub-item //'separator' splits level in 2 parts //2nd item //3rd item [/code]

Is it even possible to define the function in the xml?



You can try the following:

var myMenu = new dhtmlXMenuObject(...); myMenu.loadStruct("your xml here"); myMenu.attachEvent("onClick", function(id){ if (id == "some id") { // do stuff here } });