Help - Search - Members - Calendar
Full Version: rollover link images problem
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
goofy2feet
Hi! I hope someone can enlighten me as to what I am doing wrong here.
I've got a new page I'm putting together with rollover link images.

My code is like this :

CODE
<a href="http://www.language-global.com/new-index.php">
<div id='button4733' style='height: 49; width: 209;
background-image: url(http://www.language-global.com/sitedecor/button42580941.gif); background-position: 0px 0px; '
onmouseover = 'document.getElementById("button4733").style.backgroundPosition = "-209px 0px"; '
onmouseout =  'document.getElementById("button4733").style.backgroundPosition = "0px 0px"; '>
</div>
</a>


In Firefox, absolutely nothing displays - the screen is blank.
In IE, it works perfectly, though active contents has to be enabled.

The strange thing is, I downloaded the buttons and the code from a web-site which helps people make buttons, etc.. On their site, the button works fine in Firefox. I've checked their source code and it is identical to mine. I'm really scratching my head here - does anyone know what I am doing wrong?

I've put the page up on the net in case anyone wants to check it for themselves - http://www.language-global.com/new_index.html - this one works fine, and the php version doesn't work, even in IE : http://www.language-global.com.new_index.php

Why doesn't firefox display the rollover link buttons?
Why doesn't the php version of the page work in either browser?
Darin McGrew
Our online validator would have pointed out that you can't put a DIV element inside an A (link) element.
goofy2feet
Thank you for your reply. Unfortunately I had already found an alternative solution, but I will remember the point you make.

I found a solution that works :
CODE
<a href="new-index.php" onmouseover="document.getElementById('home').src='sitedecor/home-light.jpg'" onmouseout="document.getElementById('home').src='sitedecor/home-dark.jpg'">
<img src="sitedecor/home-dark.jpg" id="home" width="209" height="49" alt="Home" border="none" /></a>


By the way, I am just too scared to put my apalling code through a validator - there'd just be too much to put right. But I am trying to make an effort to learn good syntax, etc..
pandy
Don't be scared. You'll find that the validator is a very helpful learning tool. There may be many errors, but usually it's a few mistakes repeated many times. Take them one at the time and learn from them and you'll never make the same error again. There are links to the reference for each error in the report error, so that makes it easy to look things up. smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.