[Javascript] child nodes and the such

Golden Troll gtroll at qwest.net
Sat Dec 29 23:49:57 CST 2001


I'm trying to write a function to add title tool tips to each of my
images that are linked to bigger images I've tried the following
function and it doesn't seem to work
//
function getImages(){
// var theLink = document.getElementsByTagName("a");
	for (var i = 0; i <= document.getElementsByTagName("a").length; i++) {
//		if (document.getElementsByTagName("a")[i].childNodes){
			if ( document.getElementsByTagName("a")[i].childNodes[0].nodeName =
"IMG"){
					document.getElementsByTagName("a")[i].childNodes[0].title = "Click
to Enlarge";

			}
//		}
	}
getImages()
}
I need this to work in NN6 and IE5+ Can y'all help?
BTW did you know Opera6 is W3C DOM compliant?
Peace and Respects,
Scott Gahres
 hemp at goldentroll.com  http://goldentroll.com





More information about the Javascript mailing list