我有一系列用户选择(实现为输入框)。简短的例子:
Answer = InputBox("Choose: 1 - One 2 - Two", "Choose"))
If Answer = "1" Then
Answer = InputBox("Choose: 1 - Hi 2 - Hello", "Choose"))
If Answer = "1" Then....
我想知道VBScript是否可以返回上一步的选择。来自
InputBox("Choose: 1 - Hi 2 - Hello 3 - BACK", "Choose"))
如果我输入3我想退后一步。我试试history.go(-1)
,但是有错误。他想要对象"历史"。
答案 0 :(得分:1)
将第一个选择放在Do循环中,并且只有在第二个提示中选择了3以外的值时,才会使用Exit Do
跳出循环。
Do
Answer = InputBox("Choose: 1 - One 2 - Two", "Choose")
If Answer = "1" Then
MyVal = LevelTwoSelect
End If
If MyVal <> 3 Then Exit Do
Loop
Function LevelTwoSelect
Answer = InputBox("Choose: 1 - Hi 2 - Hello 3 - BACK", "Choose")
If Answer = "1" Then LevelTwoSelect = 1
If Answer = "2" Then LevelTwoSelect = 2
If Answer = "3" Then LevelTwoSelect = 3
End Function