# Error in my javascript file

**URL:** <https://forum.kirupa.com/t/error-in-my-javascript-file/185181>\
**Category:** web dev\
**Created:** [April 11, 2006, 4:16pm UTC](https://forum.kirupa.com/t/error-in-my-javascript-file/185181 "2006-04-11T16:16:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cubed](https://avatars.discourse-cdn.com/v4/letter/c/8dc957/32.png) [@cubed](https://forum.kirupa.com/u/cubed)\
**Post date:** [April 11, 2006, 4:16pm UTC](https://forum.kirupa.com/t/error-in-my-javascript-file/185181/1 "2006-04-11T16:16:03Z")

</div>

Hey guys,

I don’t understand how to fix this, it works fine in Firefox but when IE tries to use this file it gives me an error and says that “childNodes.0.tagName is null or not a tag name”. Any help would be great!! Here is the .js file script:

```auto

<script type="text/javascript">
   var elem = "TR"; 
   var rClick;
 window.onload = function(){
  if(document.getElementsByTagName){
   var el = document.getElementsByTagName(elem);
    for(var i=0; i<el.length; i++){
    if(el*.childNodes[0].tagName != "TH"
      && el*.parentNode.parentNode.className.indexOf("tbl") != -1){
     if(i%2 == 1){
      el*.className = "on";
      el*.oldClassName = "on";
      el*.onmouseout = function(){
	     this.className = "on";
      }
    } else {
      el*.className = "off";
      el*.oldClassName = "off";
      el*.onmouseout = function(){
	     this.className = "off";
      }
    }
      el*.onmouseover = function(){
	     if(this.className == this.oldClassName)
	       {this.className = "hover";}
	     if(this.onmouseout == null && this.className != "click"){
    	    this.onmouseout = function(){
        	    this.className = this.oldClassName;
    	    }
	     }
      }
      el*.onclick = function(){
          if(this.className != "click"){
             this.className = "click";
          } else {
             this.className = this.oldClassName;
          }
        this.onmouseout = null;
       }
    }
   }
  }
 }
</script>

```

---

<div class="post-metadata">

**Author:** ![norie](https://avatars.discourse-cdn.com/v4/letter/n/3ec8ea/32.png) [@norie](https://forum.kirupa.com/u/norie)\
**Post date:** [April 17, 2006, 6:18am UTC](https://forum.kirupa.com/t/error-in-my-javascript-file/185181/2 "2006-04-17T06:18:34Z")

</div>

can you supply a test page to show where this isn’t working? the standards when working with nodes gets a little tricky sometimes between IE and other browsers.
