/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
setHighLight = function(){ var _div = document.getElementsByTagName("div"); for (var i=0; i<_div.length; i++) { if(_div[i].className == "HightLight") { var _li = _div[i].getElementsByTagName("li"); for(var j=0; j<_li.length; j++) { _li[j].style.background = (j%2) ? "#fff" : "#f2f2f2"; } } } }