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.
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?
Question
Tjcrazy
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