[thelist] set/getAttribute is not a function?

Jon Hughes hughesj at firemtn.com
Fri Jun 15 18:42:35 CDT 2007


I have the following code:

function detpopup(obj) {
			id = obj.getAttribute('id');
			var img = "../images/" + id + ".jpg";
			alert(img);
			obj.style.height = '300px';
			obj.style.width = '600px';
			obj.style.top = '-280px';
			var image =
document.getElementById(id).getElementsByTagName('img');
			alert(image.getAttribute('src'));
			alert(img);
			image.setAttribute('src',img);
}

For some reason, getAttribute and setAttribute give me the following
error:

getAttribute is not a function
setAttribute is not a function

Anyone know why or how to fix it?

document.getElementById(id).getElementsByTagName('img'); does call the
correct element, my img tag.

Thanks,

  - Jon



More information about the thelist mailing list