View Full Version : assigning ids

Feb 16th, 2004, 10:38 PM
Can i assign an img a id like this:

when the img is mouse over i will check for an class if that class is img then i want to give the img and id

how can i do this?

Feb 16th, 2004, 11:08 PM
I'm not very sure of what you want but you may try this:

function getImageNum(n) {
var src = n.getAttribute('src');
return src;

Whenever an image is displayed on the screen, it receives automatically an id. With getAttribute you can retrieve it.

Hope this helps.


Feb 16th, 2004, 11:16 PM
helps alot thanks