SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Tennessee
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    getElementById click in firefox

    Does anyone know how i can get the getElementById().click() to work in Firefox? It works ok in IE6 but not FF. I've herd that the click() event is not supported by FF. Is there any way to fix it?

    Here is my code:
    Code:
    onMouseOver="parent.Switch.document.getElementById('DownON').click()"
    There is an iframe on the page called "Switch". inside that it loads a html file with a button with an id of "DownON". Once that button is clicked it moves some text down. Works fine like i said in IE but not FF.

    Any help would be great!

    David

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    click is supported for buttons in Firefox. The following works fine.
    Code:
    <input type="button" id="btn" onclick="alert('clicked');">
    
    <script>
    	document.getElementById("btn").click();
    </script>
    Is it a button you call the method click on?

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Tennessee
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The button is inside the iframe on the other page. The buttons are inside page2.html and the OnMouseOver is on the page1.html. So its sending the "click" to the buttons on page2 so that it will scroll the text on page2 when the user holds their mouse over the image on page1.

    Hope that helps...

    David

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What error do you get in the JavaScript console in Firefox?

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Tennessee
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The error when i have my mouse over it says:
    Code:
    parent.Switch has no properties
    David

  6. #6
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is Switch?

  7. #7
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Tennessee
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is an iframe on the page called "Switch".
    Its the iframe.
    Code:
    <iframe id="Switch" src="MiddlePage.html" width=615 height=337 marginwidth=0 marginheight=0 frameborder=0 scrolling=no></iframe>
    Page1 code for the image that the mouse rolls over:
    Code:
    <a href="#null" onMouseOver="parent.Switch.document.getElementById('DownON').onclick()" onMouseOut="parent.Switch.document.getElementById('DownOFF').onclick()"><img src="images/NK2K7off_23.jpg" alt="" width="19" height="74" border="0"></a>
    This is the page that has the buttons in the iframe:
    Code:
    <input type="button" id="downON" name="downON" onclick="scroll(-4)" /><input type="button" id="DownOFF" name="DownOFF" onclick="noScroll()" />
    David

  8. #8
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Tennessee
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone?

    David


Bookmarks

Posting Permissions

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