How can i get id value using getAttribute?

April 16, 2011 at 11:31:28
Specs: Windows Vista
hello every one
i have three images and trying to get their id value using getAttribute javascript. It does not show up. here is my code
document.getElementById('name',id);
alert(getAttribute('id'));

<input name="img" type="image" src="../../photo/cake0.jpg" id="101" onClick="changeDivImage(0)">
<input name="img" type="image" src="../../photo/cake1.jpg" id="102" onClick="changeDivImage(1)">

could you help


See More: How can i get id value using getAttribute?

Report •


#1
April 16, 2011 at 13:46:06
rather than

changeDivImage(0)

try

changeDivImage(this.id)


Report •
Related Solutions


Ask Question