过滤其他下拉菜单的 HTA vbscript 下拉菜单

发布于 2024-11-09 15:02:17 字数 97 浏览 0 评论 0原文

我对创建 HTA 相当陌生,如何创建一个下拉列表来过滤其他下拉列表的结果?我有一个包含站点名称和状态的数据库,我想要的是在选择状态后仅使用所选状态匹配的那些记录来填充站点下拉列表。

I fairly new to creating HTA's, how can I create a dropdown that will filter the results for other dropdowns? I have a database with sitename and state and what I would like is to populate the site dropdown after state is selected with just those records where the state that was selected matches.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

來不及說愛妳 2024-11-16 15:02:17

这是一个非常简单的 HTA,它根据另一个下拉列表中的选择填充一个下拉列表。应该很容易适应从数据库中读取。

<html>
<head>
    <title>Test</title>
    <HTA:APPLICATION
      APPLICATIONNAME="Test"
      ID="Test"
      VERSION="1.0"/>
</head>

<script language="VBScript">

    Sub Window_OnLoad
        Populatedropdown1
    End Sub

    Sub Populatedropdown1
            For i = 0 To 5
                Set opt = document.createElement("option")
                opt.Value = i
                opt.Text = "Option " & CStr(i)
                dropdown1.add opt
            Next    
    End Sub

    Sub Populatedropdown2
            For Each opt in dropdown2.Options
                opt.RemoveNode
            Next 
            For i = dropdown1.value To 10
                Set opt = document.createElement("option")
                opt.Value = i
                opt.Text = "Option " & CStr(i)
                dropdown2.add opt
            Next    
    End Sub
</script>

<body bgcolor="white">

    <p>Select 1: <select name="dropdown1" id="dropdown1" onchange="Populatedropdown2"></select></p>
    <p>Select 2: <select name="dropdown2" id="dropdown2" ></select></p>

</body></html>

这有帮助吗?

Here's a very simple HTA which populates one dropdown based on the selection from another. Should be easy to adapt to read from your database.

<html>
<head>
    <title>Test</title>
    <HTA:APPLICATION
      APPLICATIONNAME="Test"
      ID="Test"
      VERSION="1.0"/>
</head>

<script language="VBScript">

    Sub Window_OnLoad
        Populatedropdown1
    End Sub

    Sub Populatedropdown1
            For i = 0 To 5
                Set opt = document.createElement("option")
                opt.Value = i
                opt.Text = "Option " & CStr(i)
                dropdown1.add opt
            Next    
    End Sub

    Sub Populatedropdown2
            For Each opt in dropdown2.Options
                opt.RemoveNode
            Next 
            For i = dropdown1.value To 10
                Set opt = document.createElement("option")
                opt.Value = i
                opt.Text = "Option " & CStr(i)
                dropdown2.add opt
            Next    
    End Sub
</script>

<body bgcolor="white">

    <p>Select 1: <select name="dropdown1" id="dropdown1" onchange="Populatedropdown2"></select></p>
    <p>Select 2: <select name="dropdown2" id="dropdown2" ></select></p>

</body></html>

Does that help?

北凤男飞 2024-11-16 15:02:17

如果我的第一个下拉列表将列出父文件夹中的所有子文件夹,当我从第一个下拉列表中选取一个子文件夹时,它将生成第二个下拉列表,其中将列出其中的所有子文件夹等等?如何做到这一点?


<HEAD>
  <TITLE>K Drive Program Structure</TITLE>
  <HTA:APPLICATION ID="Eeee" 
    APPLICATIONNAME="C Drive " 
    BORDER="Dialog"
    CAPTION="Yes"
    SCROLL="NO"
    SHOWINTASKBAR="yes"
    SINGLEINSTANCE="yes"
    SYSMENU="Yes"
    WINDOWSTATE="maximize">
</HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">

Sub UpdateList
  For Each opt In list.Options
   opt.RemoveNode
  Next

  Set fso = CreateObject("Scripting.FileSystemObject")
  For Each f In fso.GetFolder("C:\WORK").SubFolders
    Set opt = document.createElement("OPTION")
    opt.Text  = f.Name
    opt.Value = f.Path
    list.Add(opt)
  Next
End Sub

Sub EnumSubFolders
  Set fso = CreateObject("Scripting.FileSystemObject")
  For Each opt In list.options
    If opt.selected Then
      Set sf = fso.GetFolder(opt.value).SubFolders

      Exit For
    End If
  Next
End Sub
</SCRIPT>

<H2>K Drive Structure</H2>
<P>CUSTOMER NAME
<select id="list" name="list" onkeydown="UpdateList" onChange="EnumSubFolders"></select><P>




<BR>
<BR>
<Input Type = "Button" Name = "btn01" VALUE = "SUBMIT">
<Input Type = "Button" Name = "btn02" VALUE = "CLOSE">
<BR>
<BR>

</BODY>

What if my first dropdown list will list all sub_folder in a parent folder, when i pick up one sub-folder from 1st dropdown, it will generate the secend dropdown list which will list all sub folder in there and so on? How to do this?


<HEAD>
  <TITLE>K Drive Program Structure</TITLE>
  <HTA:APPLICATION ID="Eeee" 
    APPLICATIONNAME="C Drive " 
    BORDER="Dialog"
    CAPTION="Yes"
    SCROLL="NO"
    SHOWINTASKBAR="yes"
    SINGLEINSTANCE="yes"
    SYSMENU="Yes"
    WINDOWSTATE="maximize">
</HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">

Sub UpdateList
  For Each opt In list.Options
   opt.RemoveNode
  Next

  Set fso = CreateObject("Scripting.FileSystemObject")
  For Each f In fso.GetFolder("C:\WORK").SubFolders
    Set opt = document.createElement("OPTION")
    opt.Text  = f.Name
    opt.Value = f.Path
    list.Add(opt)
  Next
End Sub

Sub EnumSubFolders
  Set fso = CreateObject("Scripting.FileSystemObject")
  For Each opt In list.options
    If opt.selected Then
      Set sf = fso.GetFolder(opt.value).SubFolders

      Exit For
    End If
  Next
End Sub
</SCRIPT>

<H2>K Drive Structure</H2>
<P>CUSTOMER NAME
<select id="list" name="list" onkeydown="UpdateList" onChange="EnumSubFolders"></select><P>




<BR>
<BR>
<Input Type = "Button" Name = "btn01" VALUE = "SUBMIT">
<Input Type = "Button" Name = "btn02" VALUE = "CLOSE">
<BR>
<BR>

</BODY>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文