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 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Javascript "forms" problem in Internet Explorer

    Hi,
    I have a a form in an iframe whose values are retrieved by javascript.
    The retrieval works fine in Safari and Firefox but I get an error Internet Explorer (what else is new?). Here is the line I currently have:

    var my_form = document.getElementById("iframe_page").contentDocument.forms["page_form"+i];

    my_form.submit();

    Here is the error I get from Internet Explorer:

    " 'document.getElementById(...).contentDocument.forms' is null or not an object "

    This same object, however, is retrieved without a problem, as I said, in Firefox and Safari.

    As you can see there are several forms on the page [accessed by the i variable]

    Is there a special case for internet explorer to get this same code to work?
    If so what is the call I make in the 'var my_form = ....' line?

    Thanks a ton!
    Last edited by codegreen; 12-23-2006 at 02:46 AM.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Code:
    var my_form = document.getElementById("iframe_page").contentWindow.document.forms["page_form"+i];
    That should be crossbrowser
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New Coder
    Join Date
    Dec 2006
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Kor,
    Thank you very much.


  •  

    Posting Permissions

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