www.webdeveloper.com
Results 1 to 2 of 2

Thread: onmouseover

  1. #1
    Join Date
    Jul 2004
    Posts
    339

    onmouseover

    I have two images. How do you change the image once the cursor goes over the link with the image?

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    This is a JavaScript question. Its an easy-to-answer one, though. So I will leave it here.

    I usually use the following:

    HTML:
    Code:
    onmouseover="changePic('newPic');"
    onmouseout="changePic('originalPic');"
    JavaScript:
    Code:
    function changePic(imageName) 
    {
        var newImage="images/" + imageName + ".gif";
        document.images[imageName].src=newImage;
    }
    Regards.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles