Click to See Complete Forum and Search --> : IFrame printing troubles


runlevel007
11-20-2003, 11:30 AM
I never had problems printing iFrames, but ... Can anybody help?


<HTML>
<HEAD>
<SCRIPT LANGUAGE=javascript>
<!--
function printFrame(id)
{
var iFrm=document.getElementById(id);
if (iFrm) { iFrm.focus(); // here everything is fine
iFrm.print(); } // ERROR: objects doesn't support this property or method
}
//-->
</SCRIPT></HEAD>
<BODY>
<SPAN onclick="printFrame('frame1')">Print</SPAN>
<IFRAME name="frame1" id="frame1" src="test.htm"></IFRAME>

</BODY>
</HTML>

runlevel007
11-20-2003, 02:45 PM
Anybody??

TheBearMay
11-20-2003, 02:46 PM
Haven't had to time to figure out why, but if I replace your

if (iFrm) { iFrm.focus();
iFrm.print(); }

with
eval(id).focus();
eval(id).print();
it works for me...

runlevel007
11-20-2003, 03:51 PM
It worked! I have no idea, why, but as long as it is working.

Thanks TheBearMay!:D