I think too many parentNode in JavaScript

Member

letha

by letha , in category: JavaScript , a month ago

I think too many parentNode in JavaScript 😁

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
for(var i=obj.parentNode.parentNode.childNodes.length;i>=0;i--)
{
  if(obj.parentNode.parentNode.childNodes[i]!=undefined)
  {
    if(obj.parentNode.parentNode.childNodes[i].tagName=="TR")
    {
      if (obj.parentNode.parentNode.childNodes[i].childNodes[0]!=undefined){
        for (var j=obj.parentNode.parentNode.childNodes[i].childNodes.length;j>=0;j--)
        {
          if(obj.parentNode.parentNode.childNodes[i].childNodes[j]!=undefined){
            if(obj.parentNode.parentNode.childNodes[i].childNodes[j].childNodes[0].tagName=="TABLE"){
              obj.parentNode.parentNode.childNodes[i].childNodes[j].childNodes[0].childNodes[0].childNodes[0].childNodes[0].attributes.getNamedItem("background").value = "images/category_n.png";
            }
          }
        }
      }
    }
  }
}


Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers