Firefox Issue

Posted on 2007-10-08
Last Modified: 2013-12-07
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");' />
Question by:Ashutosh Vyas
    LVL 75

    Expert Comment

    by:Michel Plungjan
    Look in the error console to see what could be the reason.

    The code does not seem wrong
    LVL 75

    Expert Comment

    by:Michel Plungjan
    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" />
    LVL 28

    Accepted Solution

    Why not simply use "this"?
    onMouseover="this.src = '../images/client2.jpg';"  onMouseout="this.src = '../images/client1.jpg';"
    LVL 8

    Author Comment

    by:Ashutosh Vyas
    thnaks i try with this.src and it worked with IE and FireFox  both.

    thanks for the help guys
    LVL 8

    Author Comment

    by:Ashutosh Vyas
    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

    Course: HTML5 Mobile App Development with PhoneGap

    PhoneGap can help you leverage your already existing HTML5, JavaScript, and CSS skills in order to create and deploy cross-platform mobile apps.This program comprehensively covers HTML5 mobile app development from top to bottom.

    Join & Write a Comment

    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
    In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
    This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now