Entry
Using windows.print() causes computer to hang. Any help will be appreciated.
Apr 6th, 2008 19:24
ha mo, Colin Fraser, Wayne Sinclair, Martin Honnen
If you are using
windows.print()
Then it is little wonder that things are not working, try
window.print()
That may help, a simple typo will cause some problems, but I would not
have thought that it would cause the computer to hang.
There is another problem here, I suspect, and that is you are trying to
get IE to print using a javascript, so an error occurs. Typically,
Microsoft's management of Javascript is poor, favouring their own ideas
over anyone elses, so you may want to use a VB Script instead.
I pinched this from Martin Honnen a long time ago, and just adapt it to
my own immediate need when required :
<object id="WBControl" width="0" height="0"
classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
<script language="VBScript"><!--
Sub VBPrint() On Error Resume Next
WBControl.ExecWB 6,1
/*
from memory, not having used this for ages, I think that this last
line may also use
WBControl.ExecWB 6,0
to stop the print confirm dialogue box from opening and annoying
users
*/
End Sub
//--></script>
<script language=JavaScript><!--
if (self.print)
document.write('<A HREF="javascript:;" language="JavaScript"
onClick="self.print(); return false;">print</a>');
else if (navigator.appName.indexOf('Microsoft') != -1)
document.write('<a href="javascript:;" language="JavaScript"
onClick="VBPrint(); return false;">print</a>');
//--></script>
Test this out, I know it works when I have used it, but it may take a
little while for you to figure it out. It wont take long, and you may be
pleasantly surprised by what you learn while doing it.
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