CapturedTech.com

Captured Technology

JavaScript OnMouseOver for Firefox

Apr 10 2009

JavaScript OnMouseOver for Firefox

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>

Blog Directory

Latest technology news.
 Patrick Stevens
 554  246481  11/15/2024

FaceBook

Translate