★ wanayoo — archive 1999 http://www.webdeveloper.com/javascript/javascript_preload_roll.htmlNouvelle recherche | Portail wanayoo
internet.com

Go to WebDeveloper Home

Seek and you shall

or search all of internet.com
Looking for a Site Map?
Vote for WD!
Please keep
voting for us
as a Top 100
Web site!
The Web Developer Network
WebDeveloper.com
Streaming Media World
WebReference.com
Web Developer's Virtual Library
BrowserWatch
Java Boutique
Web Developer's Journal
JavaScript Source
ScriptSearch
Web Developer Forums
Web Developer News

internet.com
Internet News
Internet Stocks
Internet Technology
Web Developer
Internet Marketing
ISP
Downloads
Internet Resources
International

Search internet.com
Advertising Info
Corporate Info
Internet Trade Shows

internet.commerce
Be an Affiliate
Software Store
Computer Help
Register a Domain
Be Domain Registrar
Travel
Banking
e-solutions
Internet Jobs
A/V Network
Rent E-mail Lists
Bookstore
Press Release dist.
Sell Ad Space
Internet Research
Venture Capital
Web Publishing
Build Your Intranet

  Let internet.com work for you!
T U T O R I A L
WebDeveloper.com

Pre-loading Images and Creating MouseOver Effects

By Scott Clark & Ronnie Moore

We show you how to do it, and even do it for you using our nifty script generator!

Some of the most common questions we're called upon to answer from our readers are "How can I preload some images for use in a mouseover effect?" and "How can I make an image change when the mouse is moved over it?" In this tutorial, we're going to show you how to perform both tasks, and we're even going to provide you with a Preload/Rollover Script Generator, created especially for our readers.

To get started, check out our Preload - Rollover Script Generator. Fill in the empty form fields, three for each preload/rollover effect you wish to use. The first field is for the initial image which will be shown on your page. You can use a relative URL for the image, such as alien1.gif, or you can use the full URL, like http://webdeveloper.com/javascript/alien1.gif. The second field is where you'll place the URL for the rollover image--the one that will be pre-loaded. Again, you can use a relative or a full URL. The third blank is where you'll place the URL for the hyperlink itself, such as http://www.webdeveloper.com. Continue in this fashion until you have listed all the images you wish to use as mouseovers (you can create five pre-loads/mouseovers using the generator), and then click the button on the bottom of the page.

The JavaScript code for your pre-load and your mouseover effects will be generated in the large form field at the bottom on the page. Now you'll want to cut and paste the code into your own HTML page. Place the script itself in the HEAD of your document, and then place the mouseover code where you want it to appear in the BODY of your document. The generator automatically creates the HEAD and BODY tags, but these are mostly so you'll get a better idea of where each section goes.

Here's the way it works: As the page is loading the initial images, it also pre-loads the mouseover images. As the mouse is moved over the initial image, the script changes the source for the image to the (new) mouseover image. When the mouse is moved off the image, the script changes the source back to the original image. Simple, yet elegant! This works for and with both Netscape and MSIE browsers, so have phun!

This article first appeared in January, 1999

Fast Jump to Anywhere on WebDeveloper.com:

Play the Market--win real cash!



Copyright © 1999 internet.com Corporation
All Rights Reserved. Legal Notices.
Contact the WebDeveloper.com staff

Last modified: Tue Oct 12 05:48:38 EDT 1999

http://www.internet.com

 

Refresh Daily
Join Editor-in-Chief David Fiedler The Editor With No Time and find truth, justice, and a clue or two.


Browse by Category
[ Site Map ]

ActiveX / VBscript
Animated GIF Archive
Browsers
CGI / Perl
Database Connectivity
Design / Graphics
E-Commerce
HTML-Advanced: DHTML, CSS
HTML / Site Authoring Tools
Intranet/Groupware
Java
JavaScript
Multimedia: Audio / Video / Streaming Technologies
Opinions
Refresh Daily: Editorial Column
Security
Servers & Server Tools
Site Design / Graphics
Site Management / Marketing / Log File Analysis
Tutorials
VRML / 3D
XML