selected link changes background
I have 2 menus, category and countries. I开发者_运维问答've made so far to change and keep background of one element but I have problem with 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 is HERE
You should use an object instead of an array for lookaround:
var lookaround = {};
精彩评论