gpt4 book ai didi

user-interface - 多按钮 GUI VBScript

转载 作者:行者123 更新时间:2023-12-02 17:40:30 26 4
gpt4 key购买 nike

有谁知道我如何在两个并排的垂直行 GUI 中制作一个 16 个按钮。每个按钮都会将一个名为 menuoutput 的变量设置为一个值,例如第一个按钮为 1,第二个 ECT 为 2。我一直在测试这段代码,但我不知道是否有办法向它添加 16 个按钮。

x=msgbox("Do you want to start" ,4, "Program")
If x = 6 Then
Wscript.Echo "yes"
Else
Wscript.Echo "no"
End If

最佳答案

向 VBScript 添加 GUI 的“自然”方式是编写一个 . HTA .入门指南:

<html>
<head>
<Title>menubuttons</Title>
<hta:application id="menubuttons" scroll = "no">
<script type="text/vbscript">
Function window_onload
Dim spMenu : Set spMenu = document.getElementById("spMenu")
Dim nB
For nB = 1 To 5
Dim oB : Set oB = document.createElement("input")
oB.setAttribute "type", "button"
oB.id = "B" & nB
oB.value = oB.id
Set oB.onclick = GetRef("menu")
spMenu.appendChild oB
Next
End Function
Function menu
MsgBox Me.id, vbOKOnly, "menu selection"
End Function
</script>
</head>
<body>
<span id = "spMenu"></span>
<hr />
</body>
</html>

'output'

要了解 DOM,请开始 here .

关于user-interface - 多按钮 GUI VBScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21428596/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com