I'm trying to extend the very nice image swap code from http://www.hesido.com

He creates an array of <img /> tags using .getElementsByTagName(). And I want to extend it to also look for <input /> tags with type="image".

I figured this would be easy with the array.push(), but I'm getting errors.

Here's the code in question:
Code JavaScript:
 
imgList = elem.getElementsByTagName('img'); 
inptList = elem.getElementsByTagName('input');
 
alert(imgList.length); //returns 39
alert(inptList.length); //returns 13
 
//append input images to imgList
for (var i=0; inpt = inptList[i]; i++) { 
if(inpt.type == 'image'){
//inpt equals the object it should...
imgList.push(inpt); //erors here
}
}
 
alert(imgList.length); //never runs this

In IE7, I get the error "Object doesn't support this property or method".

In FireFox, I get the error "uncaught exception: Permission denied to get property HTMLDivElement.parentNode"

Any help would be greatly appreciated!

Thanks,
Brandon