0

A few questions in one post. I am making an HTA script that has a dropdown for a few examples but then has a 'custom' option. When I click custom I would like for a text box and some words telling the user to enter a number in miliseconds to show under it and then hide if I choose another option.

My questions: 1. How do I start the textbox and the words above it hidden? 2. How do I make it appear/ disappear based on the users choice in the dropdown?

I will post the relevant code that I have as of now that I tried but does not work. Please note this is my first time messing with hta so some things might be redundant or i might be missing some parts as i just pulled the relevant parts from my script. Also right now the text box and words are not hidden on start as i don't know how to do that.

<BODY>
<SCRIPT LANGUAGE="VBScript">
Set wshShell = CreateObject("WScript.Shell")

Sub btn01_OnClick
    Dim strProduct

    Dim Timerdelay

oElements = Window.Message.SelectedIndex
    strProduct = Window.Message.Options(oElements).Text

Select Case strProduct
        Case "1 Second"
            Timerdelay=1000
            CustomTime.style.visibility="hidden"
            ShowTime.style.visibility="hidden"
        Case "3 Seconds"
            Timerdelay=3000
            CustomTime.style.visibility="hidden"
            ShowTime.style.visibility="hidden"
        Case "5 Seconds"
            Timerdelay=5000
            CustomTime.style.visibility="hidden"
            ShowTime.style.visibility="hidden"
        Case "30 Seconds"
            Timerdelay=30000
            CustomTime.style.visibility="hidden"
            ShowTime.style.visibility="hidden"
        Case "0.5 Seconds"
            Timerdelay=500
            CustomTime.style.visibility="hidden"
            ShowTime.style.visibility="hidden"
        Case "Custom"
            CustomTime.style.visibility="visable"
            ShowTime.style.visibility="visable"
            Timerdelay= CustomTime.Value
    End Select
End Sub
</SCRIPT>

<span id=ShowTime><P>Enter Your Time Delay In Miliseconds<P>
<input type="text" name="CustomTime" size="30"></span>

<Input Type = "Button" Name = "btn01" VALUE = "START">

</BODY>
Dankman69
  • 1
  • 3

1 Answers1

0

You can use the atribute onchange='myfunctionName(possible_value)' on the dropdown. On the linked function, check the value of the dropdown and your switch case should work. Also, check for syntax error such as "visable" instead of "visible".

If you don't know how to retrieve the value from the dropdown, you can refert to this link: Get drop down value

Tommy
  • 74
  • 1
  • 1
  • 9