ghmurphy
asked on
Get Javascript Print Preview working in Firefox.
I have a Javascript print preview which works wonderfully in IE. I get this Javascript error when I try to run it in Firefox. I would like to get it working in firefox or another script which does the same thing and I can use coldfusion to send the client to the appropriate script.
Here is the Firefox error message.
document.body.insertAdjace ntHTML is not a function
Here is the IE code which works great in IE.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
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-34 0A-11D0-A9 6B-00C04FD 705A2"></O BJECT>';
document.body.insertAdjace ntHTML('be foreEnd', WebBrowser);
WebBrowser1.ExecWB(OLECMDI D, PROMPT);
WebBrowser1.outerHTML = "";
}
</script>
</head>
<body>
<a href="<cfoutput>#CGI.SCRIP T_NAME#</c foutput>" onclick="printpreview();"> x</a>
</body>
</html>
Here is the Firefox error message.
document.body.insertAdjace
Here is the IE code which works great in IE.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
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-34
document.body.insertAdjace
WebBrowser1.ExecWB(OLECMDI
WebBrowser1.outerHTML = "";
}
</script>
</head>
<body>
<a href="<cfoutput>#CGI.SCRIP
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You cannot reinvent it, because there is NO print preview wheel in Mozilla that can be controlled by script.
ASKER