Web Development HTML Guide - Learn HTML
Developer Tutorials
ASP
CGI & Perl
CSS
Flash
HTML
Java
JavaScript
Linux
MySQL
PHP
Photoshop
Python
Wireless
XML



Developer Manuals
Learn HTML
Learn PHP
Learn MySQL
Learn CSS
Learn Pear


Developer Scripts
ASP Scripts
ASP.NET Scripts
CGI & Perl Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools & Utilities Scripts
XML Scripts

Developer Resources
Developer Tools
Developer News
Developer Forums
Developer Content
Developer Book Reviews
Survey Software

Web Hosting Directory
Budget Web Hosting
ColdFusion Hosting
Dedicated Servers
Domain Hosting
E-Commerce Hosting
Email Hosting
Free Web Hosting
Linux Web Hosting
Managed Hosting
Reseller Hosting
Small Business Hosting
Windows Web Hosting

Rollover Images: Several On One Page

The rollover technique from the previous pages works for as many images on a single page as you want. All you have to do is use a different name for each image. For example, suppose you have three different button images which should all be rollovers. You could create them using the following markup:

<A 
    HREF="home_ro.html"
    onMouseOver = "rollover('home')"
    onMouseOut = "rollout('home')"
    ><IMG 
    SRC="home.out.gif"
    NAME="home"
    HEIGHT=37 WIDTH=87 BORDER=0 ALT="home"
    ></A>
<SCRIPT TYPE="text/javascript">
<!--
setrollover('home.over.gif');
//-->
</SCRIPT>

<A 
    HREF="resume_ro.html"
    onMouseOver = "rollover('resume')"
    onMouseOut = "rollout('resume')"
    ><IMG 
    SRC="resume.out.gif"
    NAME="resume"
    HEIGHT=37 WIDTH=87 BORDER=0 ALT="resume"
    ></A>
<SCRIPT TYPE="text/javascript">
<!--
setrollover('resume.over.gif');
//-->
</SCRIPT>

<A 
    HREF="specs_ro.html"
    onMouseOver = "rollover('specs')"
    onMouseOut = "rollout('specs')"
    ><IMG 
    SRC="specs.out.gif"
    NAME="specs"
    HEIGHT=37 WIDTH=87 BORDER=0 ALT="specs"
    ></A>
<SCRIPT TYPE="text/javascript">
<!--
setrollover('specs.over.gif');
//-->
</SCRIPT>

This creates these buttons:

home resume specs

This example highlights one of the advantages to this particular rollover technique: it keeps all the information about each rollover in one place. It's easier to organize the information about the image and the link when you have all of it together, rather than spread across several parts of the page. However, following each image with a script creates some lengthy code, and some people find this code messy. If you prefer, you can list all the mouseover information at the beginning of the page. Just add the name of the image as the second parameter to the setrollover() command:

<SCRIPT TYPE="text/javascript">
<!--
setrollover('home.over.gif',   'home');
setrollover('resume.over.gif', 'resume');
setrollover('specs.over.gif',  'specs');
//-->
</SCRIPT>

Then create the images as before, but don't bother following each image with a script:

<A 
    HREF="home_ro.html"
    onMouseOver = "rollover('home')"
    onMouseOut = "rollout('home')"
    ><IMG 
    SRC="home.out.gif"
    NAME="home"
    HEIGHT=37 WIDTH=87 BORDER=0 ALT="home"
    ></A>

<A 
    HREF="resume_ro.html"
    onMouseOver = "rollover('resume')"
    onMouseOut = "rollout('resume')"
    ><IMG 
    SRC="resume.out.gif"
    NAME="resume"
    HEIGHT=37 WIDTH=87 BORDER=0 ALT="resume"
    ></A>

<A 
    HREF="specs_ro.html"
    onMouseOver = "rollover('specs')"
    onMouseOut = "rollout('specs')"
    ><IMG 
    SRC="specs.out.gif"
    NAME="specs"
    HEIGHT=37 WIDTH=87 BORDER=0 ALT="specs"
    ></A>


Copyright Idocs, Inc. Written by Miko Sullivan











About the NetVisits, Inc Network | Advertise
Developer Tutorials hosted by HostGator.
Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy.
Visit other NetVisits, Inc. sites: