xxxxxxxxxx
Do not use Inquisitive Iguana's answer! Notice the spelling of facebook in https://facobook.com. Visiting the webpage downloads malware onto your system
Message from my antivirus on my mac: "We've blocked the threat URL:Mal on http://dt.gnpe.com/ptmd from being downloaded."
xxxxxxxxxx
// so you got an iframe (id="myiframe"). In that page you have an element id="theprice" and you want to change its value
// from the parent page do this in your javascript:
var iframevar = document.getElementById('myiframe');
var elmnt = iframevar.contentWindow.document.getElementById("theprice");
elmnt.innerHTML = theNewPrice;
Change iFrame src attribute
xxxxxxxxxx
// Get the iframe by id and set new src attribute
document.querySelector("#viewing-frame").src = "path/to/new/src";
You can also use ".viewing-frame" to get the iframe by class or you can get the iframe directly with "iframe"
xxxxxxxxxx
<a href="foo.html" target="myiframe">Foo</a>
<a href="bar.html" target="myiframe">Bar</a>
<a href="baz.html" target="myiframe">Baz</a>
<iframe name="myiframe"></iframe>