• 0

IE9 onmouseover :(


Question

Ok, so a quick question and valuable chance for you neowinians to increase your post count ;)

I've got a snippet of code that changes my logo when a link is hovered over to show that particular page, using onmouseover and javascript. This works fine in FF3/4 and Chrome, but not in IE9 *possibly 8,7,6*.

The code is below, sorry about not hosting it myself, most of you will know how to test this code anyway.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Neowin Bug Testers!</title>
<script>
function hover(name) {
	document.getElementById('logo').innerHTML = '<img src="images/pages/'+name+'.png" border="0" />';
}
function nohover() {
	document.getElementById('logo').innerHTML = '<img src="images/logo.png" border="0" />';
}
</script>
</head>

<body>
<div id="logo"><img src="images/logo.png" border="0" /></div>
			<ul>
				<a href="#" onmouseover="hover('home');" onmouseout="nohover();">
				<li class="first">Home</li></a>
				<a href="#" onmouseover="hover('about');" onmouseout="nohover();"><li>About Me</li></a>
				<a href="#" onmouseover="hover('page1');" onmouseout="nohover();"><li>Pg1</li></a>
				<a href="#" onmouseover="hover('page2');" onmouseout="nohover();"><li>Pg2</li></a>

			</ul>
</body>
</html>

As you can see, when the mouse is above the <li>, the code should use innerHtml to change the div logo to a different image, but whatever I try in IE9 does not work :(.

Surely Im being an idiot and doing something wrong?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Nope, still doesn't work for me :/...

interesting, I also have IE9 RC on Windows7 x64- but not SP1

EDIT: Apparently IE9 auto updated to BETA

Link to comment
Share on other sites

  • 0

...Feel like an idiot now. I ignored the box, thinking that it was another pathetic beg my IE to make it my default browser... when it was actually the allow blocked content box.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.