Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > PHP/MySQL/Scripting

  • Print
  • + Share This
From the author of

To create a rollover:

(See the script, below.)

  1. <A HREF="next.html"

    The link begins by specifying where the browser will go when the user clicks on the image, in this case to the page next.html.

  2. onMouseover="document.arrow.src=
    'images/redArrow.gif' "

    When the user moves the mouse over the image, the replacement image redArrow.gif, which is inside the images directory, is written to the document window.

  3. onMouseout="document.arrow.src=
    'images/blueArrow.gif' ">

    Then, when the mouse moves away, the image blueArrow.gif is swapped back in.

  4. IMG SRC="images/blueArrow.gif"

    The remainder of the image link defines the source of the original image for the page, and closes the link tag.

Though simple, this method has its disadvantages (see the next section).

Script 1  Here's the simplest way to do a rollover, within a link tag.

        <TITLE>A Simple Rollover</TITLE>
         <A HREF="next.html" onMouseover=
         redArrow.gif' " onMouseout=
        blueArrow.gif' "
    ><IMG SRC="images/
         blueArrow.gif" WIDTH=147 HEIGHT=82
         BORDER=0 NAME="arrow"></A>
  • + Share This
  • 🔖 Save To Your Account