On Jan 15, 5:26*pm, Leona Leal Educator
<LeonaLealEduca...@xxxxxx> wrote:
> Do not program JScript or Java Script!
>
> Here is my code:
>
> <Script Language="JavaScript">
>
> * * * * * * * * function ChangeRecord(){
> * * * * * * * * var boolValid = true;
> * * * * * * * * * * * * * * * * if (document.FormA.txtPassWordA <>
> document.FormA.txtPassWordB)}
> * * * * * * * * * * * * * * * * var incomplete = "PassWords Do Not Match,
> Please Re-Enter";
> * * * * * * * * * * * * * * * * alert(incomplete);
> * * * * * * * * boolValid = false;}}
>
> </Script>
>
> <Form Name="FormA">
>
> <Input Type="PassWord" Name="txtPassWordA" Size="40"><br><br>
> <Input Type="PassWord" Name="txtPassWordB" Size="40"><br><br>
>
> <Input Type="Button" Value="Change Information" Name="B1"
> OnClick="ChangeRecord();">
>
> When I click on the Button, I get Error On Page.
>
> What am I doing wrong.
>
> My colleague entered this earlier, but under JScript. *He did not get a
> response as of this time.
>
> Thanks
>
> Granny Leona Your script has two errors. One is a typo, the other a substantial
lack of understanding of JScript.
The typo is that the closing curly bracket on this line should be an
open curly bracket ...
if (document.FormA.txtPassWordA <> document.FormA.txtPassWordB)}
The syntax error is on the same line. The not equal operator in
JScript is !==, not <>. This is the same as in C, C++, Java, etc.
So, try this ...
<Script Language="JavaScript">
function ChangeRecord()
{
var boolValid = true;
if (document.FormA.txtPassWordA !== document.FormA.txtPassWordB)
{
var incomplete = "PassWords Do Not Match, Please Re-Enter";
alert(incomplete);
boolValid = false;
}
}
</Script>
I reformatted the layout a bit to make it more readable, I think.
BTW, why are you asking this question in a VBScript group?
Tom Lavedas
***********
http://there.is.no.more/tglbatch/