Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

HTA App Dropdown Menu

$
0
0
Hello everyone!

I'm new to VBScript.
I want to make an HTA application, an application that contains a dropdown menu.
Depending on what I choose in the first menu, I will be shown options in the second menu.
Maybe you have an idea how to do it.
I leave below the code I tried and two screenshots.

Thanks!

Code:

<html>
    <head>
        <script language="VBScript">
               
                        Sub Random
                       
                                Dim a
                                Dim Array()
                               
                                Set a = document.getElementById("input").value
                               
                                If a = "INDIA" Then
                                        Array[0] = "Maharashtra"
                                        Array[1] = "Delhi"
                                Else a = "USA" Then
                                        Array[0] = "Washington"
                                        Array[1] = "Texas"
                                        Array[2] = "New York"
                                End If
                               
                                Dim i
                                Dim string
                                For i=0 To UBound(Array)
                                        string = string + "<option value="+Array[i]+">"+Array[i]+"</option>"
                                Next
                                document.getElementById("output").innerHTML = string
                        End Sub
                               
        </script>
    </head>
    <body>
        <select id="input" onchange="Random">
            <option>Select Option</option>
            <option>INDIA</option>
            <option>USA</option>
        </select>
        <div>
          <select id="output" onchange="Random">
        </div>
    </body>
</html>

Attached Images
  

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>