Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by cory on Jun 18, 2009 16:29
open dhtmlx forum
trouble setting onclick event handler

when I set the onclick event handler as shown in previous thread my menu disappears. The menu renders perfectly until I add menu.attachEvent... Here is my code:

<div id="menuObj"></div>
        <script>

// creating new menu object
var menu = new dhtmlXMenuObject("menuObj","dhx_blue");
                menu.attachEvent("onClick",function(id){var url = menu.getUserData(id,"url"))});


// loading data
menu.loadXML("menu/menu.xml");
                
</script>
Answer posted by Alex (support) on Jun 19, 2009 02:06

Hello,

there is the issue in the event handler - there is unnecessary )

try the following

 menu.attachEvent("onClick",function(id){var url = menu.getUserData(id,"url")});