• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 908
  • Last Modified:

Firefox Issue

i want to change image on Onmouseover and OnMouseout event of Img tag it's working fine in IE but it's not showing any onMouseOver/Out event in Firefix, can anyone please help me out in this. here is my code

 <img name="iconclient" id="iconclient" runat="server" src="../images/client1.jpg"
                                    onmouseover='document.getElementById("iconclient").src = "../images/client2.jpg";'
                                    onmouseout='document.getElementById("iconclient").src = "../images/client1.jpg";'
                                    style="cursor: hand; cursor: pointer; border: solid 1px gray; margin-right: 20px;"
                                    align="left" onclick='writeIFrame("placeholder_client", "../Client/ContactDialog.aspx","950","450","no");' />
Ashutosh Vyas
Ashutosh Vyas
  • 2
  • 2
1 Solution
Michel PlungjanIT ExpertCommented:
Look in the error console to see what could be the reason.

The code does not seem wrong
Michel PlungjanIT ExpertCommented:
I would personally write it like this:
<img name="iconclient" id="iconclient"
onmouseover="document.getElementById('iconclient').src = '../images/client2.jpg'"
onmouseout="document.getElementById('iconclient').src = '../images/client1.jpg'"
style="cursor: hand; cursor: pointer; border: solid 1px gray; margin-right: 20px;"
onclick="writeIFrame('placeholder_client', '../Client/ContactDialog.aspx','950','450','no');
return false" />
Why not simply use "this"?
onMouseover="this.src = '../images/client2.jpg';"  onMouseout="this.src = '../images/client1.jpg';"
Ashutosh VyasFounder, InitQubeAuthor Commented:
thnaks i try with this.src and it worked with IE and FireFox  both.

thanks for the help guys
Ashutosh VyasFounder, InitQubeAuthor Commented:
I am having another problem guys with Firefox, in the onClick of  this image tag I am calling a javascript function "writeIFrame"
// Write out an IFrame
function writeIFrame(placeholder, src, width, height, scroll)
{    var p = placeholder;
    var htmlString = "<iframe src=\""+src+"\" width=\""+width+"\" height=\""+height+"\" scrolling=\""+scroll+"\" marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" style=\"overflow-x: hidden; overflow-y: auto;\"></iframe>";
    //document.getElementById(p).innerHTML = htmlString;          
    $get(p).innerHTML = htmlString ;
which will create an IFrame, problem is that the Main page layer's is overlapping on this IFrame in Firefox and works fine in IE,any help is appreciated.

Thanks in advance.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now