PDA

View Full Version : accessing iframe field from parent pages' javascript- cant get to work



chims
08-12-2009, 04:43 AM
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...

clueful
08-13-2009, 12:17 AM
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
FrameName is a name
txtfieldName is an ID
Also ensure that the iframe is loaded.

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