hello all, i want to call window print preview (in browser, File - Print Preview) by javascript, this is the code
[CODE=javascript] function printpreview()
{
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1 " WIDTH=0 HEIGHT=0 CLASSID="CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.i nsertAdjacentHT ML('beforeEnd', WebBrowser);
WebBrowser1.Exe cWB(OLECMDID, PROMPT);
WebBrowser1.out erHTML = "";
}[/CODE]
that function triggered by input type this one below
[HTML]<input type="button" name="printPrab p" id="printPrabp " onclick = "javascript:pri ntpreview();" value="Print Preview" />
[/HTML]
but the browser shown an error "document.body. insertAdjacentH TML is not a function"
any idea please...
thanks
regards, maminx
[CODE=javascript] function printpreview()
{
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1 " WIDTH=0 HEIGHT=0 CLASSID="CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.i nsertAdjacentHT ML('beforeEnd', WebBrowser);
WebBrowser1.Exe cWB(OLECMDID, PROMPT);
WebBrowser1.out erHTML = "";
}[/CODE]
that function triggered by input type this one below
[HTML]<input type="button" name="printPrab p" id="printPrabp " onclick = "javascript:pri ntpreview();" value="Print Preview" />
[/HTML]
but the browser shown an error "document.body. insertAdjacentH TML is not a function"
any idea please...
thanks
regards, maminx
Comment