Re: Function Help Required




"Joe Fawcett" <joefawcett@xxxxxxxxxxxxxxxx> wrote in message
news:eNW%23sKi3GHA.4924@xxxxxxxxxxxxxxxxxxxxxxx
As well as Anthony's suggestion to use view source try double clicking the
error icon to get a full error message. It's likely a syntax error in
client-side script due to lack of a quote or something.


Just remember to use the previous button in the dialog. A syntax error most
often begets other errors typically 'object expected' because event code
tries to run but the function it is trying to call hasn't been built due to
the syntax error.

--

Joe Fawcett - MVP

http://joe.fawcett.name
"Anthony Jones" <Ant@xxxxxxxxxxxxxxxx> wrote in message
news:e3SyCVV3GHA.1256@xxxxxxxxxxxxxxxxxxxxxxx

"EA" <NOSPAM@xxxxxxxxxxxx> wrote in message
news:4511b765$0$2654$ed2619ec@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I am amending a web site and I have very little knowledge of
Javascript.

The function below is something I have pieced together but needlss to
say
it
does not work. When I click the button which has this function as it's
onClick event the web page does not change, but Error on Page appear in
the
status bar. I know the rest of the page is okay because if I set the
action
of the StatsForm to be Default.asp this works fine.

The problem is when I try to use the function below to check the input.

Logic.... I have a variable 'Score'. I have an array of PlayerCodes,
which
have been used to create a series of DB textboxes on the form. The
function, which is invoked when a button is clicked, should add the
values
in all these DB textboxes and compare it to the variable 'Score'. If
they
equal the form should be submitted to default.asp. If they do not
match
a
messagebox is displayed on the screen.

function TestScore() {
MyVar = <%
MyArr = Split(ArrayOfPlayerCodes)
For x=0 to ubound(MyArr)
%>(Math.round(StatsForm.DB<%=MyArr(x)%>.value)) +<%
Next
%>0
if (MyVar != <%=Score%>) {
alert('Please check your doubles, they do not equal the team score
entered! ')
}else
{
StatsForm.action='Default.asp'
StatsForm.submit()
}
}

Can anyone tell me what my error is?


I suggest that you use view source to see the final javascript generated
by
this code. I suspect that will clue you in to what is wrong with the
code.

Also are you sure all DBxxx inputs are eitther empty or just contain
numerical values.







.


Quantcast