If you want to use the index, you'd have to pass the index value, but
that's not a very good method.

Your best bet would be to pass the image object itself, so you don't
need to figure out how to get it, as such:

onmouseover="myfunction(this)"

Then your function would take the image object as an argument:

function myfunction(img)
{
    img.src = "...";
}

However, I'm not sure images actually HAVE onmouseover events, so that
might not even work. If you're just doing a rollover, you'll have to put
an <a> tag around the image and put the mouseover event there, or use
CSS rollovers instead.

Steven Olson wrote:
Hello all -

I'm trying to learn some javascript, and am stuck. I have an image with a function that is called on mouse over:

image mouseOver="javascriptFunction"

(I know the syntax is not close to right; this is just hypercode. I assume that valid syntax would not post).

Inside the javascript function, i want to act according to the index value of the image, but I do not know how to find the index value. For example, if the image that the mouseOver event is attached to is the 3rd image on the page ( document.images[3] ), and I want my function to work on that image, what method can i use get the index number (3) into a variable?

document.images.index seems to work only within a form.

My apologies if my question is poorly stated; my understanding
of javascript is still pretty shakey!

--
::::::::::::::::::::::::::::::
Howard Cheng
http://www.howcheng.com/
Wise-cracking quote goes here.

____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
      Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to