Re: Dropdown Box in VBScript? by mayayana
mayayana
Thu Jun 08 18:20:51 CDT 2006
Also, in case you need it:
You can clear the dropdown by setting length to 0.
You can add items to the dropdown with:
Dim opt
Set Opt = document.createElement("OPTION")
Opt.text = "Text to show"
SelOne.add Opt
Set Opt = Nothing
With all of that you've get pretty much the full functionality
of a normal GUI dropdown.
> John, the attached hta demonstrates the use of a dropdown
> user interface.
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but,
> no guarantee the answers will be applicable to the questions)
>
>
> John Shelly wrote:
> > I would like to replace an InputBox with a dropdown box in a very simple
> > script asking for user input prior to processing it. This is not for a
web
> > page, but to be used on XP machines. Anyone have any suggestions?
> >
> > Thanks.
> >
> > ---John
>
----------------------------------------------------------------------------
----
> <html>
> <title>myHTA</title>
> <!-- hta example by Michael Harris,
> posted on vbScript ng, 31Mar02 -->
> <hta:application id="myHTA" applicationname="myHTA"
> singleinstance="yes" windowstate="normal" caption="yes"
> showintaskbar="yes" sysmenu="yes" scroll="no"
> />
> <script language="vbscript">
> sub selOne_onchange()
> if me.selectedIndex = 0 then exit sub
> sCmd = me.options(me.selectedIndex).value
> set shell = createobject("wscript.shell")
> shell.run sCmd
> end sub
> </script>
>
> <body>
>
> <SELECT id="selOne" size="1" name="dr1">
> <option selected>Select From List</option>
> <option value='notepad.exe c:\test.txt'>Program 1</option>
> <option value='wordpad.exe c:\test.txt'>Program 2</option>
> </SELECT>
>
> </body>
> </html>