Here is an easy way to add rollover buttons without a lot of heavy Javascript. As long as the images are kept small, this is fast loading and works great in all browsers. It is VERY important when editing this code that you do it in a program that does not insert extra spaces or quotes. Any plain text editor will work well.
If you have multiple buttons on your page, you will need to number each image in the array. When you add the second button everywhere it says “img1″ you will need to name it “img2″ for the third button name it “img3″ and so on. Make sure you change the name in all three places for each button.
First, you will want to create two graphics – one for the “mouseover” button and one “mouseout” button.
For each image link you may have on a page, make sure you give the name=”img1″ attribute an unique name for each link or the script will not work.
<img src=”link_2_up.gif” width=”90″ height=”19″ alt=”Link 2″ name=”img2″ onmouseover=”document.img2.src=’link_2_down.gif’;” onmouseout=”document.img2.src=’link_2_up.gif’;”>
<img src=”link_3_up.gif” width=”90″ height=”19″ alt=”Link 3″ name=”img3″ onmouseover=”document.img3.src=’link_3_down.gif’;” onmouseout=”document.img3.src=’link_3_up.gif’;”>
Related posts:
- Javascript: Image Swap
- Javascript: Easy Popup Windows
- Formatting Tables
- Background Color & Images – Not Tables!
- Images <img>
- CSS: Menu Lists
- CSS: Padding
- CSS: Margin
- CSS: Border
- SEO: Image Optimization
- SEO: Link Building
- Menu Lists <ul>, Definition Lists <dl>
- CSS: Font Properties
- Heading Tag <h1> – <h6>
- CSS Tutorials
- Javascript Tutorials
- KDWHD Tutorials
- eBay Tutorials
- SEO Tutorials
- HTML 4.01 Strict Tutorials
- Paragraph Tags <p>
- SEO: Keyword Selection
- Beginner HTML: Your First Webpage
- CSS: External Style Sheets
- CSS Syntax
- Video: How to Install your “me” Page on eBay
- Video: How to Create Custom eBay Store Pages
- Video: How to Install Custom eBay Store Navigation
- Video: How to Install Custom eBay Store Front Page
- How Do I Add a Background Image or Color?
Comments
Leave a comment Trackback