Home |
About Us |
Contact Us |
Privacy Policy |
Copyright |
More Info |
The cons of Javascript mouseovers
Using images for navigation rollovers is not only time consuming but wasteful as well. Take the above table of rollovers. 1 image for every button and 1 for every mouseover, in total 12 images. Then you have all the javascript to maintain as well.
What if you want to change text on a link or you want to add a new link? That means getting your graphics software up and running and assuming you can find the original template image, you have to edit 2 graphics or create 2 new graphics for each link.
Once the images are created you then need to start editing the javascript code to add new links. Your <a href.. tags get bloated with onmouseover/onmouseout code.
That's just a few of the cons there are loads more :)
So, if not Javascript then how is it done?
Simple :) 2 images - a small style sheet and your links placed in a table.
You have to make sure the url path points to the on and off images. You must also set the width and height of the images in the style as well.
The table and linksWhy the links are in a table
You must build your navigation in a table. Internet Explorer and Opera will display the images correctly when not in a table. However, Mozilla doesn't. To get Mozilla to display the full width and height of the image we have to add display:block; to the style sheet. This places each button on its own line so by using a table we can have more control.
It's not really a big deal but I thought I would point out the reasons why :)
That's all there is to it