Re: Javascript error
From: Lee (REM0VElbspamtrap_at_cox.net)
Date: 08/10/04
- Previous message: Jac: "Re: Javascript error"
- In reply to: Jac: "Re: Javascript error"
- Messages sorted by: [ date ] [ thread ]
Date: 10 Aug 2004 11:29:33 -0700
=?Utf-8?B?SmFj?= said:
>
>Hey,
>
>Here are the last lines of my source.
>That is the generated code from the Page.RegisterStartupScript.
>
>....
> <script language="javascript">if(confirm('Are you sure?')){}else{return
>false;}</script>
></form></body></HTML>
>
>The error : Return outside the function. I dont' see why.
>
>Second question : How can I (the code behind) catch the answer?
Putting code at the end of the page does not mean that it
will be executed when somebody leaves the page. It means
that it will be executed as soon as the end of the page is
loaded into the browser.
As has been pointed out to you, the reason for the error is
that you're using the "return" keyword outside of a function.
It looks like you want this code to be the body of a function
that is called by an event handler, such as when the visitor
clicks on a link or pushes a button. If that's what you want,
then we can help you.
If you add the code to an event handler, you don't need to
catch the answer. The event handler will take care of
cancelling the operation (leaving the page) for you.
- Previous message: Jac: "Re: Javascript error"
- In reply to: Jac: "Re: Javascript error"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|