执行 ExeRun("file:///c:/print.exe")时,页面变白屏,无反应,只能直接关闭。
请问这是什么问题?代码如下:
function CreateFile(str)
{
var fso, tf;
fso = new ActiveXObject("Scripting.FileSystemObject");
if (fso.FileExists("c:\\testfile.txt"))
{
fso.DeleteFile("c:\\testfile.txt"); }
tf = fso.CreateTextFile("c:\\testfile.txt", true);
tf.WriteLine(str) ;
tf.Close();
ExeRun("file:///c:/print.exe");
}
function ExeRun(command)
{
window.oldOnError=window.onerror;
window._command=command;
window.onerror=function(err)
{
if(err.indexOf('automation')!=-1)
{
alert("命令"+window._command+"已经被用户禁止!");
return true;
}
else return false;
}
var wsh=new ActiveXObject("WScript.Shell");
if(wsh)
wsh.Run(command);
window.onerror=window.oldOnError;
}
请问这是什么问题?代码如下:
function CreateFile(str)
{
var fso, tf;
fso = new ActiveXObject("Scripting.FileSystemObject");
if (fso.FileExists("c:\\testfile.txt"))
{
fso.DeleteFile("c:\\testfile.txt"); }
tf = fso.CreateTextFile("c:\\testfile.txt", true);
tf.WriteLine(str) ;
tf.Close();
ExeRun("file:///c:/print.exe");
}
function ExeRun(command)
{
window.oldOnError=window.onerror;
window._command=command;
window.onerror=function(err)
{
if(err.indexOf('automation')!=-1)
{
alert("命令"+window._command+"已经被用户禁止!");
return true;
}
else return false;
}
var wsh=new ActiveXObject("WScript.Shell");
if(wsh)
wsh.Run(command);
window.onerror=window.oldOnError;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货