I simply want to run vbcode in the Head portion of the web page to determine if an error occurred. If so, I want to change the backcolor of the screen to red.
In my VBScript version, I get an error at the subroutine calling line
"Type mismatch"
I've tried using a subroutine and a function. I have tried passing parameters and not passing parameters.
Here is the code
<html><head>
<!--
This screen is the Inventory location entry
-->
<script TYPE="text/vbScript">
sub AMakeRed()
backcolor = red
end sub
</script>
<script TYPE="javaScript">
function mainmenu()
{
document.forms[0].action="InventoryMenu.asp";
document.forms[0].submit();
}
</script>
<TAble align="center"><tr><td>
<B> Move Unit Screen </B>
</td></tr></Table>
<%
Dim ErrArr(10)
If request.form("LastScreen") = "InventoryMove1.asp" then
'See if the location to Move to is a valid location
set Conn = server.createobject("ADODB.Connection")
Conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=TN-MEM-TS1;DATABASE=Brother; User Id=webuser; Password=webuser;"
Set Loc = Server.CreateObject("ADODB.Recordset")
SQL = "Select * from InventoryLocs where Location = '" & request.form("MoveTo") & "'"
Loc.Open SQL,Conn,1,2
If Loc.EOF then
EditsPassed = "N"
ECount = ECount + 1
ErrArr(ECount) = "Invalid Move to Location "
ErrArr(4) = SQL
' Makered1()
Else
If Loc("LocType") = "SWAP" then
response.redirect("InventoryMove2S.asp")
Else
Response.redirect("InventoryMove2NS.asp")
End if
End IF
Loc.Close
set Loc = nothing
If len(request.form("MoveTo") )> 1 and ECount > 0 then
' response.redirect("InventoryMove1.asp")
end if
End if
%>
</head>
<form name="InventoryMoveUnit1" action="InventoryMove1.asp" method="Post" target="_parent">
<body OnLoad="document.InventoryMove1.Location.focus();" bgcolor="#FFFFCC">
<Table align="Center">
<tr>
<TD>Move to Location   </td>
<TD><Input type="Text" size="5" Name="MoveTo" ></td>
</tr>
<% If ECount > 0 then
AMakeRed() ' <---This line causes a Type mismatch error
%>
<tr>
<TD colspan="2"><B>Move to Location Invalid </td>
</tr>
<% End if %>
</Table>
<Input type="hidden" value="InventoryMove1.asp" name="LastScreen">
<Input type="HIDDEN" value="TEST" name="Tst">
<Table align="Center">
<TR>
<TD>
</td></tr>
<TR><td> </TD></TR>
<TR><td>
<Input type="button" value="Main Menu" name="UserID" onClick="mainmenu()">
</td></tr></table>
</form>
</body>
</html>
Can you see the error?