Wait for iframe to load in JavaScript

First of all, I believe you are supposed to affect the src property of iframes, not location. Second of all, hook the iframe’s load event to perform your changes:

var myIframe = document.getElementById('righttop');
myIframe.addEventListener("load", function() {
  this.contentWindow.document.notesform.ID_client.value = Client;
});
myIframe.src="https://stackoverflow.com/questions/1463581/timesheet_notes.php";

Again, this is all presuming you mean iframe, not framesets.

Leave a Comment