Subscribe in a reader
Written by: 4/10/2009 1:26 PM
I wrote a fairly simple JavaScript line to modify the size of an image when there is a OnMouseOver event. And then wrote a similar line of JavaScript to reduce the size back to normal on the OnMouseOut event. The only problem is the JavaScript didn't work on FireFox although it was great with Internet Explorer. After some research I found that using the 'this' object was needed with FireFox. So I adjusted my code to also have the events in the image object itself. Here is the code:
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" height="700px" width="215px">
<tr height="140px" width="195px" align="center">
<td><a href="AboutUs.aspx"
onmouseover="document.getElementById('AboutUs').style.width='205px'; document.getElementById('AboutUs').style.height='112px'"
onmouseout="document.getElementById('AboutUs').style.width='195px'; document.getElementById('AboutUs').style.height='105px'">
<img border="0" alt="About Us" src="/Images/Home/AboutUs.gif" style="height: 105px; width:195px; position: static;" id="AboutUs"
onmouseover="this.style.width='205px'; this.style.height='112px'"
onmouseout="this.style.width='195px'; this.style.height='105px'" />
</a></td></tr>
</table>
</div>
17 comment(s) so far...
Re: JavaScript OnMouseOver for Firefox Amazing blog! Why can't you write for our blog :(.
Re: JavaScript OnMouseOver for Firefox
Amazing blog! Why can't you write for our blog :(.
Re: JavaScript OnMouseOver for Firefox Interesting idea and well implement but would it not be better to swap images instead, replacing the smaller one with a bigger one?That way you'd not get any image quality issues with resizing.
Interesting idea and well implement but would it not be better to swap images instead, replacing the smaller one with a bigger one?That way you'd not get any image quality issues with resizing.
Re: JavaScript OnMouseOver for Firefox So does this work on Firefox and IE?If so it could be a neat solution.
So does this work on Firefox and IE?If so it could be a neat solution.
Re: JavaScript OnMouseOver for Firefox From my understanding it should work on both browsers
From my understanding it should work on both browsers
Re: JavaScript OnMouseOver for Firefox Thanks for the code. I've been having the same problem with firefox. Great work.
Thanks for the code. I've been having the same problem with firefox. Great work.
Re: JavaScript OnMouseOver for Firefox I am just looking for this, good post and thanks for the code.
I am just looking for this, good post and thanks for the code.
Re: JavaScript OnMouseOver for Firefox Wow, Nice job. Maybe you can share a sample of your code or application of the javascript you made.
Wow, Nice job. Maybe you can share a sample of your code or application of the javascript you made.
Re: JavaScript OnMouseOver for Firefox Thanks, this was a real life saver for my mario flash games site :)
Thanks, this was a real life saver for my mario flash games site :)
Re: JavaScript OnMouseOver for Firefox Thanks for providing the code.
Thanks for providing the code.
Re: JavaScript OnMouseOver for Firefox Thanks for sharing the codes. I've been having the same problem when I'm using both Firefox and Internet explorer. I hope this time that both will work.
Thanks for sharing the codes. I've been having the same problem when I'm using both Firefox and Internet explorer. I hope this time that both will work.
Re: JavaScript OnMouseOver for Firefox Good modification done.Hope it's working well now.
Good modification done.Hope it's working well now.
Re: JavaScript OnMouseOver for Firefox Awesome, I was trying to figure out how to do that and this worked like a charm!
Awesome, I was trying to figure out how to do that and this worked like a charm!
Re: JavaScript OnMouseOver for Firefox thanks for the coder , i have saved the code for my work use :)
thanks for the coder , i have saved the code for my work use :)
Re: JavaScript OnMouseOver for Firefox it's very nice, thanks for the code
it's very nice, thanks for the code
Re: JavaScript OnMouseOver for Firefox Thanks for your code.
Thanks for your code.
Re: JavaScript OnMouseOver for Firefox Thanks for sharing the code
Thanks for sharing the code
Re: JavaScript OnMouseOver for Firefox Great thanks for such a useful information as that one!Grateful a lot!
Great thanks for such a useful information as that one!Grateful a lot!