Reputation: 35
My assignment is to create two iframes. In one have a catalog where you characteristics of shoes, socks and shirts. The data from the 1 iframe is not moving over to the second iframe.
It says “document
is undefined
or null
”.
function doit() {
window.frames[0].document.form1.txtprice.value = window.frames[1].document.form2.priceResult.value;
}
Upvotes: 1
Views: 292
Reputation: 780663
To access the document in an iframe you use the contentDocument
property.
window.frames[0].contentDocument.form1.txtprice.value = window.frames[1].contentDocument.form2.priceResult.value;
Also, this will only work if both iframes are from the same domain as the original page.
Upvotes: 2