Hello, with the following VBScript in an HTML doc I keep getting a "type mismatch" error when I click the Submit button; it tries but fails to call the function.
Please help! The code is below, it can be pasted into an HTML doc.
---
<HTML>
<HEAD>
<SCRIPT language="VBScript">
<!--
SUB btnLogin_onClick
login()
end sub
function login()
dim strUserName, strPassword, strDepartment
strUserName = document.frmLogin.txtUserName.value
strPassword = document.frmLogin.txtPassword.value
strDepartment = document.frmLogin.lstDepartment.value
select case strUserName
case "KFoster"
if (strPassword = "MST3K") then window.location.href = strDepartment & ".htm"
end if
case "CSchwab"
if (strPassword = "OKC802") then window.location.href = strDepartment & ".htm"
end if
case "FHelms"
if (strPassword = "Telcom52") then window.location.href = strDepartment & ".htm"
end if
case "KShea"
if (strPassword = "Ghost716") then window.location.href = strDepartment & ".htm"
end if
case else window.location.href="loginFormVB.htm"
end select
end function
-->
</SCRIPT>
</HEAD>
<TITLE>Login Form</TITLE>
<BODY>
<CENTER>
<h1>Login Form</h1>
</CENTER>
<FORM method="post" name="frmLogin" action="javascript:void(0)">
<INPUT type="text" name="txtUserName">UserName<BR><BR>
<INPUT type="text" name="txtPassword">Password<BR><BR>
<P>
Department
<SELECT name="lstDepartment" size="1">
<OPTION value="administration">Administration</OPTION>
<OPTION value="customer">Customer</OPTION>
</SELECT>
</P>
<P><INPUT type="button" value="Go to the Department Website!" name="btnLogin"></P>
<P><INPUT type=button name="btnClear" value="Clear Form"; ></P>
<SCRIPT FOR="btnLogin" EVENT="onClick" LANGUAGE="VBScript">
login
</SCRIPT>
</FORM>
</BODY>
</HTML>
Please help! The code is below, it can be pasted into an HTML doc.
---
<HTML>
<HEAD>
<SCRIPT language="VBScript">
<!--
SUB btnLogin_onClick
login()
end sub
function login()
dim strUserName, strPassword, strDepartment
strUserName = document.frmLogin.txtUserName.value
strPassword = document.frmLogin.txtPassword.value
strDepartment = document.frmLogin.lstDepartment.value
select case strUserName
case "KFoster"
if (strPassword = "MST3K") then window.location.href = strDepartment & ".htm"
end if
case "CSchwab"
if (strPassword = "OKC802") then window.location.href = strDepartment & ".htm"
end if
case "FHelms"
if (strPassword = "Telcom52") then window.location.href = strDepartment & ".htm"
end if
case "KShea"
if (strPassword = "Ghost716") then window.location.href = strDepartment & ".htm"
end if
case else window.location.href="loginFormVB.htm"
end select
end function
-->
</SCRIPT>
</HEAD>
<TITLE>Login Form</TITLE>
<BODY>
<CENTER>
<h1>Login Form</h1>
</CENTER>
<FORM method="post" name="frmLogin" action="javascript:void(0)">
<INPUT type="text" name="txtUserName">UserName<BR><BR>
<INPUT type="text" name="txtPassword">Password<BR><BR>
<P>
Department
<SELECT name="lstDepartment" size="1">
<OPTION value="administration">Administration</OPTION>
<OPTION value="customer">Customer</OPTION>
</SELECT>
</P>
<P><INPUT type="button" value="Go to the Department Website!" name="btnLogin"></P>
<P><INPUT type=button name="btnClear" value="Clear Form"; ></P>
<SCRIPT FOR="btnLogin" EVENT="onClick" LANGUAGE="VBScript">
login
</SCRIPT>
</FORM>
</BODY>
</HTML>