waytech2003
Programmer
I have a problem with printing an Iframe after I load it from code. I want to have the user click on a link or button, to load a page into an Iframe. After it has loaded, I want it to print.
The experimental code below will envoke the print feature, but the page has not loaded yet. After you print or cancel, the the page is loaded.
I first tried this without the setTimout() and there was no differance.
How can I print only after the Iframe page is loaded?
The experimental code below will envoke the print feature, but the page has not loaded yet. After you print or cancel, the the page is loaded.
I first tried this without the setTimout() and there was no differance.
How can I print only after the Iframe page is loaded?
Code:
<html>
<head>
<script language="javascript" type="text/javascript">
function frameLoad(whichFrame){
document.getElementById(whichFrame).src="page1.htm";
window.setTimeout(PrintFrame(whichFrame),5000);
}
function PrintFrame(whichFrame){
parent[whichFrame].focus();
parent[whichFrame].print();
}
</script>
</head>
<body>
<p onclick="frameLoad('Iframe1');">Load and Print Iframe</p>
<iframe id="Iframe1"></iframe>
</body>
</html>