How to Create a Drop-Down List in VBScript

104 1
    • 1). Create an HTML page in the text editor or IDE: <html> <body> <p>A form with a drop down list</p> </body> </html>

    • 2). Add a form to the HTML page: <form method="POST" name="formWithList"> </form>

    • 3). Make a list of options you want to offer the user, such as a list of countries or a list of colors.

    • 4). Decide on the logic to process the user selection of a particular option from the drop-down list.

    • 5). Use the "select" tag to add a drop-down list to the form and the "option" tag to list the options you chose in Step 3:

      <p><select name="countryList" size="1">

      <option value="USA"> USA </option>

      <option value="Canada"> Canada </option>

      <option value="UK"> UK </option>

      </select>

      <input type="button" name="handleList" value="processSelectionButton">

    • 6). Add VBScript code to handle the user's selection:

      <script for="processSelectionButton" event="onClick" language="VBScript">

      dim choice

      choice = document.formWithList.countryList.selectedindex

      <!-- add your custom code based on logic in step 4 to handle the selection -->

      </script>

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.