Windows Vista Forums

Java Script Syntax Problem

  1. #1


    Leona Leal Educator Guest

    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

  2. #2


    Tom Lavedas Guest

    Re: Java Script Syntax Problem

    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

  3. #3


    Leona Leal Educator Guest

    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:

    > 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

  4. #4


    Leona Leal Educator Guest

    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:

    > 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

  5. #5


    Leona Leal Educator Guest

    Re: Java Script Syntax Problem

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

    "Leona Leal Educator" wrote:

    > 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">

    > 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:
    >

    > > 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

  6. #6


    Antonette Guest

    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:

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

    > > 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">
    >

    > > 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:
    > >

    > > > 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

Java Script Syntax Problem

Similar Threads
Thread Forum
Generic Interface syntax in VS 2005 using Old syntax
Hi All, Im using managed c++ syntax (VS 7) in VS 2005. And i want to implement a generic interface in it. But im getting errors when i try to...
.NET General
Install flash player (done! ) then java script..where..how??
Vista home premium.. I.E. 7 ...I tried to display some sports videos on www.Yahoo.com and an error message said "need the latest Flash player...
Vista General
Java script alert color issue
Hi, Can you please help me in fixing the Java script alert color issue in Vista. Java script alert displayed in the web application coming in two...
General Discussion
Move computer in AD based on DSQUERY script syntax help!
Hi, I have run a dsquery against my AD for computer accounts with a stale password of 90 days. I now have this list of computers in a text file....
VB Script
downloading java script to window vista
I have problem downloading java script to window vista. It keep telling me that the publisher was not able to recognise the 'encryptor'. please help...
Vista General
Example of a script converted to HTML with syntax highlighting
http://nightroman.spaces.live.com/blog/cns!F011223B604739FA!137.entry Take a look at yet another example of a PowerShell script converted to HTML...
PowerShell
Time Java script
With XP I was using a US gov sight that gave continuous accurate time, but can't get it to work with Vista. Keep getting an error message...
Vista security