Re: Javascript error

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Lee (REM0VElbspamtrap_at_cox.net)
Date: 08/10/04

  • Next message: Franco Finstad: "Re: Iframe and javascript"
    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.


  • Next message: Franco Finstad: "Re: Iframe and javascript"

    Relevant Pages

    • Re: pop Up Window from .cs file
      ... I dont think that is going to work for me either. ... private void ResetButton_Click(object sender, ... // Code that will pop-up a window ... the ResetButton_Click event handler in the website.aspx.cs file. ...
      (microsoft.public.dotnet.framework.aspnet.webcontrols)
    • Re: Repeat an ASP:Image button
      ... I dont know how to calculate that. ... You can bind the same event handler to multiple buttons dynamically. ... Figuring the screen resolution of the ...
      (microsoft.public.dotnet.framework.aspnet)
    • VCL event handler in a DLL
      ... I'm writing a DLL, which uses Indy TidHTTP VCL component, and I dont know ... how to assign an event handler to it. ...
      (alt.comp.lang.borland-delphi)
    • VCL event handler in a DLL
      ... I'm writing a DLL, which uses Indy TidHTTP VCL component, and I dont know ... how to assign an event handler to it. ...
      (comp.lang.pascal.delphi.misc)
    • DataGridView Dirty Pen
      ... Cancelling a CellValidating event handler works OK ... Cancelling a RowValidating event handler causes the "Dirty Pen" to ... disappear even though uncommitted proposed value is still in the cell - ...
      (microsoft.public.dotnet.framework.windowsforms)