Background Hight Light


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. setHighLight = function(){
  2. var _div = document.getElementsByTagName("div");
  3. for (var i=0; i<_div.length; i++) {
  4. if(_div[i].className == "HightLight") {
  5. var _li = _div[i].getElementsByTagName("li");
  6. for(var j=0; j<_li.length; j++) {
  7. _li[j].style.background = (j%2) ? "#fff" : "#f2f2f2";
  8. }
  9. }
  10. }
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.