Opinions? Javascript or images?
I'm wondering if anyone can give me an opinion on this. Recently, I was asked to edit our company's website by replacing the left frame with an image and then putting text links on top of the image. They wanted "rollover" links like the IE "hover" effect. Only they're all using Netscape so I couldn't just use the "hover" tag. So I created image rollovers that look like text. Since that time, I've been trying to find a way to make a hover effect that works cross-browser. I finally came up with one, but when I looked at it at home I notice that the script runs slowly on my older computer (sometimes the color change can't keep up with the mouse in Netscape). So I don't know if I'm saving time or not using DHTML. What's less annoying - images that have to preload for rollovers or a script that might work slowly on some people's browsers? I hate making images of plain text because it seems like lots of wasted images. Here's the sample page showing the left frame. This one uses DHTML -- the image rollover version looks exactly the same (assuming you have stylesheets enabled). The layout wasn't my idea, but oh well. Obviously it would look weird if stylesheets were turned off. But image rollovers would look weird too with images turned off! I'd like to hear opinions on this. Which version would you use & why? Here's the source text of the left frame. I'd be interested if anyone knows a way to simplify it so that it works faster. Thanks, Phyllis
P. S. The links on this sample page won't actually work (except for the absolute links) because this page isn't relative to the files I'm linking to (I just put it here as an example).
John Pollock posted this at 18:58 — 7th April 2000.
He has: 628 posts
Joined: Mar 1999
Hi Phyllis:
I think you will want to make your choice based on the audience of the site-- you'll want to know what percentage of people are using DHTML capable browsers.
If it is very high, then you might want to go with the DHTML one as it will be faster for those with the new browsers.
On the other hand, if the percentage is not really high I would suggest using the images since they work further back (though even this won't work in a really old browser.
You can of course use browser checks for either one to prevent old browsers from performing the script. I'm not sure what the bosses want though..
------------------
John Pollock
http://www.pageresource.com
http://www.javascriptcity.com
Java Script: A Beginner's Guide
Page Resource
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.