Forum Moderators: open

Message Too Old, No Replies

Help with Replacement Rollover Code

         

Mirella Miel

11:42 pm on May 22, 2004 (gmt 0)



Hello there, all you technologically advanced thinkers! Someday I hope to join your world, but at this time, I've only scratched the surface of web design.

Anyway, I'm currently trying to make a replacement rollover code for multiple (about seven, not including their mouseover form) graphics. One that any professional website would use, with quick-loading preloaded images. I've searched all over the web and everyone keeps telling me to use a WYSIWYG editor like Dreamweaver. I even bought a book (perhaps some of you are familiar with it: Designing web graphics .4, by Lynda Weinman), and even it says the same thing! (By the way, I needed the book anyway, so I didn't waste my money.) Now, just using Dreamweaver would probably be all fine and dandy, if I had a ton of cash, but I don't. Plus, if I let DW do all the work, I won't learn anything.

So, please, would some experienced person walk me through this fancy rollover code? Your help would be more appreciated than you could possibly imagine.

Thank you.

~Mirella -- Whom is wanting to be a web designer someday, but is having much trouble teaching herself.

Rambo Tribble

1:41 am on May 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are a variety of ways to produce rollover effects. An article I did for Lockergnome describes one and can be found at: [channels.lockergnome.com...]

The article is titled "CODE: Peeling the Onion for a Simpler Understanding of DHTML". Note that the code in the article includes an instruction for onmouseout that shouldn't have been part of the article. The source on the sample page at the link listed in the article has the corrected code.

normaldude

1:49 am on May 23, 2004 (gmt 0)

10+ Year Member



This goes in the <head> area:

<script language="JavaScript">
<!--
// pre-cache all rollover images
var roimg1_out = new Image(85,35);
roimg1_out.src = "button1a.gif";
var roimg1_over = new Image(85,35);
roimg1_over.src = "button1b.gif";
//-->
</script>

This part goes in the <body> area:


<img src="button1a.gif" width="85" height="35" border="0"
onMouseOut="this.src = roimg1_out.src"
onMouseOver="this.src = roimg1_over.src">

Obviously, you'll have to change the file sizes and file names.