Delay form submission

Problem description, the form does not submit and the window closes. (Automatic submission may also cause EOFException, reduce the processing of the request stream (such as file size checking), and allow the request to be completed as soon as possible)

script>

 function  testSubmit(){
   var  form=document.getElementById("form1");
  form.submit();
  window.close(); 
  }
 </script>
 <body scroll="no">
   <form id="form1" action="fileUploadController.do?uploadfile2" enctype="multipart/form-data" method="post">  
        file:<input type="file" name="file"><br>  
        <input type="button" value="提交"  onclick="testSubmit()">  
    </form>  

 </body>

1. You can set action to action="#" and re-assign action in testSubmit

  var  form=document.getElementById("form1");

  form.attr("action","fileUploadController.do?uploadfile2" );

 form.submit();

 window.close();

2. js function source code tracking eventListeners to quickly locate the source code

    [1] Select the element to be tracked, ----> check

 There are links to source files in EventListeners ------>

[2] Click the location of the source file to jump to the js source file



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325381027&siteId=291194637