我在自己程序中导入 smsx.cab文件后 代码如下:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<!-- MeadCo Security Manager -->
<object viewastext style="display:none" classid="clsid:5445be81-b796-11d2-b931-002018654e2e" codebase="smsx.cab#Version=6,3,435,20">
<param name="GUID" value="{232E61C9-1E90-4657-AEDB-6F02F3B2EE37}"/>
<!--<param name="Path" value="sxlic.mlf"/>-->
<param name="Revision" value="0"/>
<param name="template" value="MeadCo://IE7" />
</object><!-- MeadCo ScriptX -->
<object id="factory" viewastext style="display:none"classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814">
</object>
<script defer>
function SetPrintSettings()
{ // -- advanced features
factory.printing.SetMarginMeasure(2);
// measure margins in inches
factory.printing.printer = "HP DeskJet 870C";
factory.printing.paperSize = "A4";
factory.printing.paperSource = "Manual feed";
factory.printing.collate = true;
factory.printing.copies = 2;
factory.printing.SetPageRange(false, 1, 3);
// need pages from 1 to 3 // -- basic features
factory.printing.header = "This is MeadCo";
factory.printing.footer = "Advanced Printing by ScriptX";
factory.printing.portrait = false;
factory.printing.leftMargin = 1.0;
factory.printing.topMargin = 1.0;
factory.printing.rightMargin = 1.0;
factory.printing.bottomMargin = 1.0;
}
function Print(frame)
{
factory.printing.Print(true, frame)
// print with prompt
}
</script>
<input type="button" id="b1" value="打印本页" onclick="javascript:document.all.factory.printing.Print(false);"/>
<input type="button" id="b2" value="页面设置" onclick="javascript:document.all.factory.printing.PageSetup();"/>
<input type="button" id="b3" value="打印预览" onclick="javascript:document.all.factory.printing.Preview();"/>
</div>
</form>
</body>
</html>
在自己电脑IE7上访问没问题,可是在其他电脑 IE7 上访问javascript就会提示 document.all.factory.printing 为空或不是对象!!
怎么办~~~怎么回事~~~
谢谢`?
------解决方案--------------------------------------------------------
这是因为scriptX需要浏览器安装加载项,你需要在codeBase=‘下载地址/smsx.cab#Version=6,3,435,20’,
这样客户端在浏览的时候会提示安装ActiveX,安装后就可以了。还有你应该在你的js里面写try{}catch(err){},
这样就不会出脚本错了。
------解决方案--------------------------------------------------------
ScriptX.cab解开,把里面的三个dll注册一个就可以了。最好服务器和各客户端都注册一下。