| Working with frames |
|
|
|
| Written by WebRuss |
| Wednesday, 22 July 2009 16:01 |
|
I was working on a project where an html page had an iframe inside it. The challenge was to allow the parent page to communicate with the child iframe and the child to communicate with the parent. Letting the parent talk to the child. The easiest way I found is using javascript. Let's say the child's (iframe) ID is "child". Now within javascript all you need is to use is the following: document.getElementById("child").src = url; By using the getElementById method you can adjust any element within the child.
Letting the child talk to the parent. You guessed it! Again the simplest way is javascript. Lets say the parent html document has a text box with the ID of "first_name" parent.document.getElementById("first_name").value = "WebRuss" This same code can be used in the onclick or onload events of links or buttons.
|
| Last Updated on Wednesday, 22 July 2009 16:21 |


