JavaScript-Why does this code commit to the past?

Source: Internet
Author: User
At first I was experimenting with this short code to start onsubmit= "return false" to write the direct return false so that the click button that prevents the form from being submitted does not have any reaction, and then I change to the form of a function to prevent form submission as if the following code looks Change it so people say you can stop the form submission but I'm not trying. Click the button is not a little reaction there will be a page refresh and address bar address will be more than one later? It's not the same as the previous direct return to false. The second paragraph of the code is also the case with onsubmit= "return check ()" Nothing to fill in the direct point commits can also be submitted to the database does not prevent the submission who knows my code where there is a problem why not prevent the submission?

        

Second paragraph

    
  
                                       

Reply content:

At first I was experimenting with this short code to start onsubmit= "return false" to write the direct return false so that the click button that prevents the form from being submitted does not have any reaction, and then I change to the form of a function to prevent form submission as if the following code looks Change it so people say you can stop the form submission but I'm not trying. Click the button is not a little reaction there will be a page refresh and address bar address will be more than one later? It's not the same as the previous direct return to false. The second paragraph of the code is also the case with onsubmit= "return check ()" Nothing to fill in the direct point commits can also be submitted to the database does not prevent the submission who knows my code where there is a problem why not prevent the submission?

        

Second paragraph

    
  
                                       

function check(){         return false;        };

This sentence do not put in the window.onload inside, directly in the outer layer to try, I tried the feasible

Add a breakpoint to track it ~
Return function if code execution problems are handled by true

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.