Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with this.click(); function in mozilla/firefox

    Hi,

    I'm trying to open a dialog box by clicking on an image. When a user clicks on an image....it open the Hidden HTMLINPUTFILE...and then a user selects an image and the the image that he clicked on initially will be replaced with the image he selected from the dialog box....now this works fine in IE....but the click event does not work in firefox......has anybody encountered this problem....

    can anybody help me with the workaround here or if there is any other solution to do what i want to achieve....

    This is the code i use....

    <script language="javascript">
    function t()
    {
    document.getElementById('test').click();
    }
    function tt()
    {
    document.getElementById('imgxyz').src = document.getElementById('test').value;

    }
    </script>

    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:Button id="Button1" runat="server"
    Text="Button"></asp:Button><INPUT onclick="t();"
    type="button" value="Button"><INPUT type="file" onchange="tt();" id="test"><IMG width="50" height="50" onclick="t();" id="imgxyz"
    alt="" src=""> </form>
    </body>

    Thanks in advance.

    Cheers

  • #2
    New Coder
    Join Date
    May 2006
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi!
    Maybe this helps

    eval(document.getElementById('test').attributes["onchange"].value);

    or maybe you want
    eval(document.getElementById('test').attributes["onclick"].value);


    Greetings
    Dieter
    ---

  • #3
    New Coder
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Thanks for the reply.....but what i'm doing above is that...when i click the image...i call the Input File CLick event so that the dialog box opens up.....it works great in IE...but not in Firefox.....

    Please help!

    Thanks

    Regards

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Sorry, my suggestion did not work either
    Last edited by Mr J; 02-19-2007 at 07:33 PM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #5
    New Coder
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Thanks for the reply.

    I tried it...did not work......

    Please copy my code and test it on IE by clicking the Image.......and then test it on Mozilla....you will know what i need....

    Cheers

  • #6
    New Coder
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    ANybody with a solution to my problem......

    please help...its urgent...

    thanks

    regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •