change iframe content with javascript code example
Example 1: change element in iframe
// 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;
Example 2: change iframe src by javascript
//change iframe src get the iframe then . and src and provide a value
document.getElementById("myFrame").src = "https://facobook.com";