How can I access form fields in iframe through Javascript when clicking an event outside iframe?
On a Web page I am displaying a form using iframe. On clicking one event (outside the iframe), I want to access the form fields (in iframe) through Javascript. Would you please suggest how to do that? Thanks in advance.
To set yourName to the value of the field "yourname" of the myForm form in the iframe, try this.
var iframe = document.getElementById ("myFrame"); var iframeDoc = iframe.Document; var iframeForm = iframeDoc. getElementById("myForm"); var yourName = iframeForm. yourname.value;
Do you have comments on this Ask the Expert Q&A? Let us know.