Results 1 to 2 of 2

Thread: accessing iframe field from parent pages' javascript- cant get to work

  1. #1
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post accessing iframe field from parent pages' javascript- cant get to work

    Hi,
    In my jsp page, I have an iFrame and I want to access a text field inside this iframe in my parent page's javascript.

    Tried many ways.. but cudnt get it work...

    eg: window.frames['FrameName'].document.getElementById('txtfieldName');

    kinda urgent..Please help...

  2. #2
    Join Date
    Jul 2008
    Posts
    128
    Thanks
    0
    Thanked 17 Times in 16 Posts

    Default

    Quote Originally Posted by chims View Post
    Hi,
    In my jsp page, I have an iFrame and I want to access a text field inside this iframe in my parent page's javascript.

    Tried many ways.. but cudnt get it work...

    eg: window.frames['FrameName'].document.getElementById('txtfieldName');

    kinda urgent..Please help...
    That should work provided that
    1. FrameName is a name
    2. txtfieldName is an ID
    Also ensure that the iframe is loaded.

    You could also use:document.getElementById('iframeID').contentWindow.document.getElementById('txtfieldID');

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
  •