![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 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 Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
| | #4 (permalink) |
| | 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 Specs![]() |
| | #5 (permalink) |
| | 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> 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 Specs![]() |
| | #6 (permalink) |
| | 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 Specs![]() |
![]() |
| 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 | |||