...

View Full Version : SOLVED - javascript image replace question from a newbie



graphicsgirl
10-04-2012, 06:23 PM
Hi there,
Sorry for the really basic question. I am trying a simple image replace which is working fine in most browsers but not in Safari. I can't find why. can anyone help?


<a href="#" title="Test portfolio Item" onmouseover="document.image_2.src='uploads/news/id2/narrowboats-2.png';" onmouseout="document.image_2.src='uploads/news/id2/narrowboats-1.png';">
<img src="uploads/news/id2/narrowboats-1.png" width="235" height="132" alt="Test portfolio Item" id="image_2" />
</a>

xelawho
10-04-2012, 06:33 PM
I haven't tested it, but it's possible that Safari is one of the few browsers left that will not let you address elements by their bare id. If that's the case you would be looking for something like


onmouseover="document.getElementById('image_2').src='uploads/news/id2/narrowboats-2.png';"
//etc


which will work in all browsers

graphicsgirl
10-05-2012, 03:48 PM
That did it! Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum