I am currently working on a program that will require an iframe to read data from the display screen when the screen is loaded. So far I have had no luck reading in anything to the iframe. Here is a section of my javascript code for the iframe:
<p id="Var1"></p>
<p id="Var2"></p>
<script type="text/javascript">
document.getElementById("Var1").innerHTML = txtVar1;
document.getElementById("Var2").innerHTML = parent.document.getElementById(window.txtVar1);
</script>
These attempts that I have made in the javascript have not worked for me.
Is this even possible with using the profound iframe widget or am I not coding this correctly?
Any information you could give me would be great
Thanks
Reading parent variable into iframe
-
- New User
- Posts: 12
- Joined: Fri Nov 30, 2012 3:48 pm
- First Name: Mike
- Last Name: Rojek
- Company Name: McGard
- State / Province: New York
- Zip / Postal Code: 14127
- Country: United States
- Contact:
Reading parent variable into iframe
- Attachments
-
- demo.rpgle.txt
- (396 Bytes) Downloaded 57 times
-
- demo.dspf.txt
- (3.09 KiB) Downloaded 57 times
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Reading parent variable into iframe
Assuming your goal is to retrieve the contents of the textbox named 'txtVar1' in the parent frame, you could do that like this:
The code that you provided as an example is using a Javascript variable named txtVar1 instead of looking for a DOM element with that name.
Code: Select all
var myVar = parent.pui.get("txtVar1");
-
- New User
- Posts: 12
- Joined: Fri Nov 30, 2012 3:48 pm
- First Name: Mike
- Last Name: Rojek
- Company Name: McGard
- State / Province: New York
- Zip / Postal Code: 14127
- Country: United States
- Contact:
Re: Reading parent variable into iframe
Scott,
Works perfectly! Thanks for the quick reply!
Works perfectly! Thanks for the quick reply!
Who is online
Users browsing this forum: Majestic-12 [Bot] and 1 guest