geudrik Posted September 1, 2009 Share Posted September 1, 2009 I have an iFrame setup that looks like... <iframe name="contentFrame" width="720px" src="http://10.209.91.30:4110/web2e" frameborder="0" scrolling="auto" marginwidth="0" marginheight="0" height="400px" class="frameclass"></iframe> In this iFrame, I have a javascript variable that is set and reset every time the page is loaded/reloaded... <script type="text/javascript"> var FormNameVariable="10008001"; </script> In my parent frame, I need to either reference directly, or re-create the variable to be equal to what ever that var is set to in the iFrame. I am trying... var GetFormName = window.contentFrame.FormNameVariable; I also have a function to spit out what ever that variable is.. function writeformname() { document.write(GetFormName); } In the parent frame (which, by the way isn't a frame - the iFrame is nested within a single HTML file) when I call that function, I get 'Undefined'. What purpose of doing this, setting the variable and referencing it, is so that I can click a button from the parent window, and have it submit (click a button) within the iFrame. I am using the following code for this... <input name="_KEN" type="submit" value="Enter" id="_KEN" class="submenu_special" onclick="javascript:parent.contentFrame.document.GetFormName._KEN.click()" /> Where am I going wrong? Note: The buttons in the iFrame are named, in this case, the above button code should be "Clicking" the button with the name of _KEN (yes, this button does exist) Lastly, on occasion, the form name in the iFrame changes - each time the iFrame is refreshed, the variable I am setting is also refreshed. So, is there a way to continually keep the variable in the parent window updated? Quote Link to comment https://forums.phpfreaks.com/topic/172742-iframes-and-javascript/ Share on other sites More sharing options...
geudrik Posted September 2, 2009 Author Share Posted September 2, 2009 bump Quote Link to comment https://forums.phpfreaks.com/topic/172742-iframes-and-javascript/#findComment-910906 Share on other sites More sharing options...
RichardRotterdam Posted September 3, 2009 Share Posted September 3, 2009 I find your description slightly confusing. Maybe the following thread will help you: http://www.phpfreaks.com/forums/index.php/topic,147397.0.html Quote Link to comment https://forums.phpfreaks.com/topic/172742-iframes-and-javascript/#findComment-911479 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.