var ie=WScript.CreateObject("InternetExplorer.Application","IEEvent_");
ie.Navigate("about:blank");
while (ie.Busy){
    WScript.Sleep(200);
}

ie.Width = 200;
ie.Height = 130;
ie.Left = 200;
ie.Top = 200;
ie.MenuBar = false;
ie.AddressBar = false;
ie.StatusBar = false;
ie.ToolBar = false;
ie.Visible = true;

var document = ie.Document;
document.body.scroll = "no";
document.title = "请输入密码";
document.body.innerHTML = "<input id=pwd><input id=btnCheck value=确定 type=button>";
document.getElementById('btnCheck').onclick = function(){
    document.getElementById('pwd').value = 'test';
}

// 注意此脚本的生命周期
var exit_flag = false;
while(!exit_flag){
    WScript.sleep(100);
}

function IEEvent_OnQuit(){
    exit_flag = true;
    WScript.Echo("IEEvent_OnQuit");
}

 脚本中需要图形界面来接收用户输入时,使用这个比较方便。


本文链接地址: Windows脚本宿主(JavaScript)动态创建表单
http://qingfengju.com/index.asp?id=363

分类:脚本编程 查看次数:3012 发布时间:2013-11-27 11:28:42