javascript - selected link changes background -
i have 2 menus, category , countries. i've made far change , keep background of 1 element have problem simultaneous memory of other menu's element.
var lookaround=[]; function seleitem(obj,color){ if(lookaround[obj.classname]) lookaround[obj.classname].style.background=null; lookaround[obj.classname]=obj; obj.style.background=color; }
example page here
you should use object instead of array lookaround:
var lookaround = {};
Comments
Post a Comment