admin管理员组

文章数量:1410689

I cannot figure out what I did or did not do here syntactically to cause this error. I don't see what's missing:

function ShowWaitMessage(button)
{
    var isValid;

    if (buttonSelected())
    {
        showWaitMessage(button, "showMessage1");
        isValid = true;
    }
    else
    {
        Page_ClientValidate();
        if (Page_IsValid)
        {
            showWaitMessage(button, "showMessage2");
            isValid = true;
        }
    }

    return isValid;
}

I cannot figure out what I did or did not do here syntactically to cause this error. I don't see what's missing:

function ShowWaitMessage(button)
{
    var isValid;

    if (buttonSelected())
    {
        showWaitMessage(button, "showMessage1");
        isValid = true;
    }
    else
    {
        Page_ClientValidate();
        if (Page_IsValid)
        {
            showWaitMessage(button, "showMessage2");
            isValid = true;
        }
    }

    return isValid;
}
Share Improve this question asked Apr 22, 2010 at 21:28 PositiveGuyPositiveGuy 47.8k112 gold badges314 silver badges479 bronze badges 2
  • I would look into the parts in the if statements more closely! – Mahesh Velaga Commented Apr 22, 2010 at 21:32
  • my fault. I had a ment right on the same line as one of my if statements..you can't do that unfortunately and I hate that. That was the problem that you would not have seen here. – PositiveGuy Commented Apr 23, 2010 at 14:12
Add a ment  | 

3 Answers 3

Reset to default 2

I had a ment on the same line as one of my if statements....causing this whole issue.

I don't think there's anything syntactically wrong with your code, having "run" it in both FireFox and IE. (By "run" I mean "loaded in a <script> tag", which ought to find syntax errors.)

What line does the error message point to?

You're missing a declaration of the Page_IsValid variable. I'm guessing that it's a local variable set inside of Page_ClientValidate, which isn't in scope in this function?

You should probably also initialize isValid to false instead of leaving it undefined if both checks fail.

本文标签: javascriptExpected ExpressionStack Overflow