Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Java Script Syntax Problem

Reply
 
Old 01-15-2009   #1 (permalink)
Leona Leal Educator


 
 

Java Script Syntax Problem

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

My System SpecsSystem Spec
Old 01-15-2009   #2 (permalink)
Tom Lavedas


 
 

Re: Java Script Syntax Problem

On Jan 15, 5:26*pm, Leona Leal Educator
<LeonaLealEduca...@xxxxxx> wrote:
Quote:

> 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/
My System SpecsSystem Spec
Old 01-15-2009   #3 (permalink)
Leona Leal Educator


 
 

Re: Java Script Syntax Problem

I put it here because my associate put it in JScript this AM. He did not get
a response and I had trouble bringing JScript up.

Our district is off and on a military base, most of the software was written
in Assembler.

Why, I do not know, but it is very good, but very old.

Thanks for helping us out!

Granny

"Tom Lavedas" wrote:
Quote:

> On Jan 15, 5:26 pm, Leona Leal Educator
> <LeonaLealEduca...@xxxxxx> wrote:
Quote:

> > 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/
>
My System SpecsSystem Spec
Old 01-15-2009   #4 (permalink)
Leona Leal Educator


 
 

Re: Java Script Syntax Problem

Tom;

Thanks for getting back to me, but it is better, but still not working. I
get the message that the password are not equal even if they are:

Current Code:

<Script Language="JavaScript">
function ChangeRecord(){

var boolValid=true;

if (document.forms.txtPasswordA !== document.forms.txtPasswordB)
{
var incomplete = "PassWords Do Not Match, Please Re-Enter!";
alert(incomplete);
boolValid = false;
}

if (boolValid==true)
{
document.FormA.action = "NewMemB.Asp";
document.FormA.submit();
}
}

</Script>

Password <Input Type="PassWord" Name="txtPasswordA" Size="10"
MaxLength="11"><%Response.Write Sp04%>
Retype Password<%Response.Write Sp04%><Input Type="PassWord"
Name="txtPasswordB" Size="10" MaxLength="11">

<Input Type="Button" Value="Update Information" Name="B3"
OnClick="ChangeRecord()">

Thanks Again

"Leona Leal Educator" wrote:
Quote:

> I put it here because my associate put it in JScript this AM. He did not get
> a response and I had trouble bringing JScript up.
>
> Our district is off and on a military base, most of the software was written
> in Assembler.
>
> Why, I do not know, but it is very good, but very old.
>
> Thanks for helping us out!
>
> Granny
>
> "Tom Lavedas" wrote:
>
Quote:

> > On Jan 15, 5:26 pm, Leona Leal Educator
> > <LeonaLealEduca...@xxxxxx> wrote:
Quote:

> > > 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/
> >
My System SpecsSystem Spec
Old 01-15-2009   #5 (permalink)
Leona Leal Educator


 
 

Re: Java Script Syntax Problem

I GOOFED, TRYING SO MANY THINGS, THAT I SUBMITTED A TYPO!

"Leona Leal Educator" wrote:
Quote:

> Tom;
>
> Thanks for getting back to me, but it is better, but still not working. I
> get the message that the password are not equal even if they are:
>
> Current 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;
> }
>
> if (boolValid==true)
> {
> document.FormA.action = "NewMemB.Asp";
> document.FormA.submit();
> }
> }
>
> </Script>
<form name="FormA">
Quote:

> Password <Input Type="PassWord" Name="txtPasswordA" Size="10"
> MaxLength="11"><%Response.Write Sp04%>
> Retype Password<%Response.Write Sp04%><Input Type="PassWord"
> Name="txtPasswordB" Size="10" MaxLength="11">
>
> <Input Type="Button" Value="Update Information" Name="B3"
> OnClick="ChangeRecord()">
>
> Thanks Again
>
> "Leona Leal Educator" wrote:
>
Quote:

> > I put it here because my associate put it in JScript this AM. He did not get
> > a response and I had trouble bringing JScript up.
> >
> > Our district is off and on a military base, most of the software was written
> > in Assembler.
> >
> > Why, I do not know, but it is very good, but very old.
> >
> > Thanks for helping us out!
> >
> > Granny
> >
> > "Tom Lavedas" wrote:
> >
Quote:

> > > 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/
> > >
My System SpecsSystem Spec
Old 01-15-2009   #6 (permalink)
Antonette


 
 

Re: Java Script Syntax Problem

Leona;

You need to tell Java that the field has a value.

Change to:

if (document.FormA.txtPasswordA.value != document.FormA.txtPasswordB.value)

I am sure it will work.

Good Luck

Toni

"Leona Leal Educator" wrote:
Quote:

> I GOOFED, TRYING SO MANY THINGS, THAT I SUBMITTED A TYPO!
>
> "Leona Leal Educator" wrote:
>
Quote:

> > Tom;
> >
> > Thanks for getting back to me, but it is better, but still not working. I
> > get the message that the password are not equal even if they are:
> >
> > Current 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;
> > }
> >
> > if (boolValid==true)
> > {
> > document.FormA.action = "NewMemB.Asp";
> > document.FormA.submit();
> > }
> > }
> >
> > </Script>
>
> <form name="FormA">
>
Quote:

> > Password <Input Type="PassWord" Name="txtPasswordA" Size="10"
> > MaxLength="11"><%Response.Write Sp04%>
> > Retype Password<%Response.Write Sp04%><Input Type="PassWord"
> > Name="txtPasswordB" Size="10" MaxLength="11">
> >
> > <Input Type="Button" Value="Update Information" Name="B3"
> > OnClick="ChangeRecord()">
> >
> > Thanks Again
> >
> > "Leona Leal Educator" wrote:
> >
Quote:

> > > I put it here because my associate put it in JScript this AM. He did not get
> > > a response and I had trouble bringing JScript up.
> > >
> > > Our district is off and on a military base, most of the software was written
> > > in Assembler.
> > >
> > > Why, I do not know, but it is very good, but very old.
> > >
> > > Thanks for helping us out!
> > >
> > > Granny
> > >
> > > "Tom Lavedas" wrote:
> > >
> > > > 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/
> > > >
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Install flash player (done! ) then java script..where..how?? Vista General
Move computer in AD based on DSQUERY script syntax help! VB Script
downloading java script to window vista Vista General
Example of a script converted to HTML with syntax highlighting PowerShell
Time Java script Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46