Differences, advantages and disadvantages between onsubmit and submit

< body >

    <form id="fs">
        <input type="text" id="su" value="sads" name="kol"/>
        <input type="submit" id="bs"  />
    </form>
    
    <script>
        var bu=document.getElementById("su")
        var bs=document.getElementById("fs")
        var bh=document.getElementById("lis")
       1. bs.onsubmit=function(){
            bs.submit()
            
        }
        2.bs.submit()
    </script>
</body>
nsubmitsubmit12onsubmitbs.submit()2
Jul.18,2021

is similar to the difference between onclick and click , click is a method, onclick is an event

  1. onsubmit means that the function is executed only when the submit action is triggered (there are two ways, 1 is to click the submit button in the form, 2. Press enter when the form is focused, and the submit action can be triggered. You can imagine it as onclick . Only the click action will trigger the function
  2. .
  3. The submission event of the bs.submit () form is submit , and the form form has a default submission method, which should usually be written as
  4. .
<form method="GET" action="js_examples.asp" >
...
</form>
action in

is the address of the submission

if you write bs.submit () directly, then submit

directly to this address.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b349b9-2bf3e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b349b9-2bf3e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?