【问题标题】:Help Continue VBS String?帮助继续 VBS 字符串?
【发布时间】:2011-05-13 23:06:23
【问题描述】:

我对 VBScript 和一般计算机编程非常陌生。
如果我要这样做:

a=inputbox("Password:") 
if a="Drop Zero" then 
    msgbox"Loging On" 
else
    msgbox"Invalid"
end if 

a=inputbox("Hello, what would you like to know:")

在第二个输入框之后,我无法继续使用 if 和 else。对于像我这样的 nOOb,任何帮助都将受到高度赞赏。!!

【问题讨论】:

    标签: vbscript


    【解决方案1】:

    我无法理解您的问题。
    无论如何,如果您在密码错误时需要退出,您可以试试这个:

    a=inputbox("Password:") 
    if a="Drop Zero" then 
        msgbox"Logging On" 
    else
        msgbox"Invalid"
        WScript.Quit
    end if 
    
    a=inputbox("Hello, what would you like to know:")
    

    更新:
    看看这段取自here的代码:

    Function ValidInteger(sNumber,iMin,iMax)
    
        If IsNumeric(sNumber) = 0 Then
            If InStr(sNumber,".") Then
                If CLng(sNumber)>= iMin And CLng(sNumber)<= iMax Then 
                    ValidInteger=""
                Else
                    ValidInteger = "You must enter a number between " & iMin & " and " & iMax
                End If
            Else
                ValidInteger = "You must enter a whole number"
            End If
        Else
            ValidInteger = "You must enter a number value"
        End If
    End Function
    

    【讨论】:

    • if、else、end if语句可以有多个吗?
    • @user753143:我编辑了我的帖子,举了一个例子。答案是肯定的,你需要多少都可以
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多