i get this error tree.attachEvent is not a function


Such problem may occur only if you are using really old version of dhtmlxtree ( dhtmlxtree 1.4 or earlier ) , which has different way to attach custom code to inner events.