VBScript等于问题 [英] VBScript equals problems

查看:53
本文介绍了VBScript等于问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用vbs登录和注册程序,但是我有一个功能齐全的工作注册程序,但是在查看输入框a.k.a密码是否等于文件中注册记录的密码时遇到麻烦

I have been working on a vbs login and signup program I have a fully functional working signup program but I am having troubles seeing if a inputbox a.k.a the password is equal to the logged password from signup in a file

    uname = inputbox("Please type your Username.")
    pword = inputbox("Please ebter your Password.")

    Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile(uname + ".txt",1)
    strFileText = objFileToRead.ReadLine()
    objFileToRead.Close
    Set objFileToRead = Nothing
    If strFileToRead = pword Then
        document.write("Welcome!")
              CreateObject("WScript.Shell").Run "forums.htm"
    Else 
    msgbox("Incorrect Username or Password")
    Wscript.Quit
    End If

推荐答案

使用"Option Explicit".然后像

Use "Option Explicit". Then blunders like

strFileText = objFileToRead.ReadLine()

vs.

If strFileToRead = pword Then

( strFileText<> strFileToRead )

将被抓住.

这篇关于VBScript等于问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆