如何在js中关闭IE窗口?
以下是一段自动登陆GMAIL的JS,可以直接保存为a.js运行.但是我想让它在3秒后自动关闭,应该怎么写啊?
ar ie=WScript.createobject( "InternetExplorer.Application ");
var args = WScript.arguments;
ie.Navigate( "https://www.google.com/accounts/Login?continue= ");
SynchronizeIE();
var doc=ie.document;
doc.forms[0].Email.value= "lixianmin@gmail.com ";
doc.forms[0].Passwd.value= "密码写在这里 ";
doc.forms[0].submit();
SynchronizeIE();
ie.Visible=true;
//等待IE操作结束。
function SynchronizeIE()
{
while(ie.Busy)
{
WScript.Sleep(100);
}
}
------解决方案--------------------var ie=WScript.createobject( "InternetExplorer.Application ");
var args = WScript.arguments;
ie.Navigate( "about:blank ");
SynchronizeIE();
var doc=ie.document;
//doc.forms[0].Email.value= "lixianmin@gmail.com ";
//doc.forms[0].Passwd.value= "密码写在这里 ";
//doc.forms[0].submit();
SynchronizeIE();
ie.Visible=true;
WScript.Sleep(3000);
ie.Quit();