<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>Forums Topic: Check to make sure a page has fully loaded first before printing it</title>
<link>http://www.tutorialhelpdesk.com/forum/</link>
<description>Tutorialhelpdesk programming forums</description>
<language>en</language>
<pubDate>Fri, 21 Nov 2008 21:05:10 +0000</pubDate>

<item>
<title>thdadmin on "Check to make sure a page has fully loaded first before printing it"</title>
<link>http://www.tutorialhelpdesk.com/forum/topic/check-to-make-sure-a-page-has-fully-loaded-first-before-printing-it#post-10</link>
<pubDate>Tue, 01 Jul 2008 20:20:24 +0000</pubDate>
<dc:creator>thdadmin</dc:creator>
<guid isPermaLink="false">10@http://www.tutorialhelpdesk.com/forum/</guid>
<description>&#60;p&#62;The following javscript code helps you determine if the page you are trying to print has loaded completely. This prevents users from printing partialy loaded pages. This problem occurs when a visitor tries to print a page and a page suitable for printing is generated by the browser.&#60;br /&#62;
&#60;strong&#62;This is the button that upon click prints the page:&#60;/strong&#62;&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;form name=&#38;quot;xform&#38;quot;&#38;gt;&#38;lt;input type=&#38;quot;button&#38;quot; value=&#38;quot;print&#38;quot;
	onclick=&#38;quot;self.print()&#38;quot;&#38;gt;&#38;lt;/form&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;strong&#62;This is the code that check to see if the page has loaded:&#60;/strong&#62;&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;html&#38;gt;
&#38;lt;head&#38;gt;
&#38;lt;script language=&#38;quot;javascript&#38;quot;&#38;gt;
    var doneloading = false;
    function printpage()
    {
       if(doneloading)
       {
          window.print();
       }
       else
       {
          alert(&#38;#39;page is not done loading yet! please wait and try again.&#38;#39;)
       }
    }

    function finishloading()
    {
       doneloading=true;
    }
    &#38;lt;/script&#38;gt;
&#38;lt;/head&#38;gt;
&#38;lt;body&#38;gt;
.. ...
&#38;lt;a href=&#38;quot;printpage()&#38;quot;&#38;gt;&#38;lt;img alt=&#38;quot;print page&#38;quot;
	src=&#38;quot;images/button-image.gif&#38;quot; border=&#38;quot;0&#38;quot;&#38;gt;&#38;lt;/a&#38;gt;
&#38;lt;/body&#38;gt;
&#38;lt;/html&#38;gt;
... ..&#60;/code&#62;&#60;/pre&#62;</description>
</item>

</channel>
</rss>
