Swap images via JavaScript

With the following JavaScript it is easy to reokace an image with another when the mouse is hovering over it:

[CODE javascript]
function imgreplace(Image,Url)
{
document.images[Image].src = Url;
}
[/CODE]

The HTML code for the image looks like this:

[CODE HTML]
Image
[/CODE]

The normal.png is replaced with hover.png when the mouse hovers over the image (onMouseOver). The image is replaced again when the mouse leaves the image (onnMouseOut).

Permanentlink zu diesem Beitrag: http://techblog.steffmeister.at/swap-images-via-javascript/

Schreibe einen Kommentar

Your email address will not be published.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.