当前位置:DOS资源站资料中心VBS脚本 → HTML编写VBS交互界面(checkbox)

HTML编写VBS交互界面(checkbox)

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2008-4-14 16:48:08

DIM checkbox

Set moWindow = WScript.CreateObject("InternetExplorer.Application", "IE_")
moWindow.Navigate2 "about:blank"
With moWindow.Document.ParentWindow
        .Document.Write "<input type=""checkbox"" name=""cb1"">格式化 C 盘
" &_
                "<input type=""checkbox"" name=""cb2"">格式化 D 盘
" &_
                "<input type=""checkbox"" name=""cb3"">格式化 E 盘
" &_
                "<input type=""checkbox"" name=""cb4"">格式化 F 盘
" &_
                "<input type='button' value=' OK 'class='ok' id='cmdOK'/>" &_
                "<input type='button' value='CANCEL' class='cancel' id='cmdCancel'/>"
        .MoveTo .Screen.AvailWidth/2-150,.Screen.AvailHeight/2-150
        .ResizeTo 300,200
        .Document.Title ="选项"
End With
moWindow.Document.Close

With moWindow
.Toolbar = False
.Statusbar = False
.Menubar = False
.Visible = True
.Resizable = False
Set .document.all.cmdCancel.onclick = GetRef("evtCancel")
Set .document.all.cmdOK.onclick = GetRef("evtOK")
End With

mbFinished = False
Do
        WScript.Sleep 50
        If mbFinished Then Exit Do
Loop

Wscript.echo checkbox


Sub evtCancel
        mbFinished = True
        moWindow.Quit
        Wscript.Quit
End Sub

Sub evtOK
        checkbox = moWindow.Document.All.cb1.checked
        checkbox = checkbox & "," & moWindow.Document.All.cb2.checked
        checkbox = checkbox & "," & moWindow.Document.All.cb3.checked
        checkbox = checkbox & "," & moWindow.Document.All.cb4.checked
        mbOK = True
        mbFinished = True
        moWindow.Quit
End Sub

Sub IE_onQuit
        mbFinished = True
End Sub