0

I have a simple (main) page with a iframe within it.
The (main) page has a form, which i need to access from within iframe

From within the iframe i am trying to refer to form elements in the main page.

I have tried all of these - but with no success in Chrome browser:

top.document.getElementById('myform');
Error message: Cannot call method 'getElementById' of undefined

parent.getElementById('myform');
Error message: Object [object global] has no method 'getElementById'

parent.document.myform.mytextbox.value;
Error message: Cannot read property myform of undefined.

In IE - i can simply do - works in IE:

parent.document.myform.mytextbox.value;

If it matters: I am trying this on my desktop, the html pages are not hosted in any webserver. So there is no domain as such...

Any idea? I am hoping to make it work in Firefox and also find something that works in IE, Chrome, FireFox

EDIT
I am also seeing this message (via developer tools of chrome):

Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.

Is this what is root cause of the issue?

Jasper
  • 8,440
  • 31
  • 92
  • 133
  • use window.parent https://developer.mozilla.org/en-US/docs/Web/API/window.parent?redirectlocale=en-US&redirectslug=DOM%2Fwindow.parent – Ehsan Jul 14 '13 at 11:40

1 Answers1

0

try to use iframe src="page.php?param=value" and onchange function

Sagar V
  • 12,158
  • 7
  • 41
  • 68