faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 47 people (17%) answered Yes
Recently 0 of 10 people (0%) answered Yes

Entry

Is possible to print a page with frames as laid out on screen automatically?

Apr 6th, 2008 19:23
ha mo, Colin Fraser, Francesco Defazio,


There are two answers here, yes and no. OK I am having an each way bet
here, but the point is that you can print individual frames or all
frames in a page, but of course you can also destroy a rainforest trying
to get it to work the way you want it to and someone else has their
computer set up differently and destroy yet another rainforest printing. 
Perhaps the easiest way is to setup another page that is only used to
print. It will print exactly the way you want it to, by you suppplying a
print button, or some other printing cue, without threatening global
warming.
What you may also want to try is : 
<script language="JavaScript"><!--
function printFrames(which) {
    if (which.frames.length == 0)
        which.print();
        //alert(which.location.href);   
        //display the frames to be printed rem the which.print(); line
        //unrem the alert
    else
        for (var i=0;i<which.frames.length;i++)
            printFrames(which.frames[i]);
}
if (window.print) {
    document.write('<form><input type="button"
onClick="printFrames(top)" value="Print Document"><\/form>');
}
//--></script>
Good luck.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com