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

msgbox display html option value

$
0
0
Hi Everyone,

I wonder if you can help. I have a hta file which loads in a directory of files from a database.
When the user clicks the select box I want a message box to display what option they selected. Can anyone help. This is my code:

Code:

<html>
  <head>
      <title></title>
      <link rel="stylesheet" type="text/css" href="" />
         
      <HTA:APPLICATION
        ID="objHTAHelpomatic"
        APPLICATIONNAME=""
        SINGLEINSTANCE="yes"
        WINDOWSTATE="normal"
        MAXIMIZEBUTTON="No"
        SCROLL="NO"
        BORDER="Dialog"
        ICON = ""
        >
  </head>
<SCRIPT Language="VBScript">

    Sub Window_OnLoad
        window.resizeTo 800,670
    End Sub

        Sub FillNames()
                Dim sConnect
                Dim objCmd
                Dim objRS

                sConnect = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=db.accdb;Persist Security Info=False"

                Set objCmd = CreateObject("ADODB.Command")
                objCmd.ActiveConnection = sConnect

                objCmd.CommandText = "SELECT [normalised_name] FROM tbl_dir;"

                Set objRS = CreateObject("ADODB.Recordset")
                Set objRS = objCmd.Execute
               
                While Not objRS.EOF
            Set objOption = Document.createElement("OPTION")
            objOption.Text = objRS("normalised_name")
            objOption.Value = objRS("normalised_name")
            dir_list.Add(objOption)
                        objRS.MoveNext
                Wend
               
                objRS.Close
                Set objRS = Nothing
        End Sub
       
        Sub FillDesc
                Dim sConnect
                Dim objCmd
                Dim objRS

                sConnect = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=db.accdb;Persist Security Info=False"

                Set objCmd = CreateObject("ADODB.Command")
                objCmd.ActiveConnection = sConnect

                objCmd.CommandText = "SELECT [normalised_name] FROM tbl_dir;"

                Set objRS = CreateObject("ADODB.Recordset")
                Set objRS = objCmd.Execute
               
                While Not objRS.EOF
            Set objOption = Document.createElement("OPTION")
            objOption.Text = objRS("normalised_name")
            objOption.Value = objRS("normalised_name")
            dir_list.Add(objOption)
                        objRS.MoveNext
                Wend
               
                objRS.Close
                Set objRS = Nothing
        End Sub
       
       
        Sub test(obj)
        msgbox dir2
        End Sub

</SCRIPT>

<body onload="FillNames()">
        <div id="left">
        <h3>Directory</h3>
        <select id="dir2" size="5" name="dir_list" style="height:500;width:350" onclick="test me"></select>
        </div>
        <div id="right">
        <h3>Description</h3>
        <textarea rows="4" cols="50" style="width:400;height:300"></textarea>
        </div>
</body>

</html>


Viewing all articles
Browse latest Browse all 688

Trending Articles



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