The following are several ways to submit js
We often need to submit forms or hyperlinks through js
1.js submit form (.submit() method submits the form)
function doSearch(){ var action ="<%=path%>/User_queryAllUser"; document.all.form.action = action; document.all.form.submit(); }
2.js submits the form (.submit() method submits the form)
<script type="text/javascript"> function addSubmit() { var targetForm = document.forms[ "form1" ]; targetForm.action = "logo.do?method=downAdd"; targetForm.submit(); } </script> <form name="form1" method="post" action="logo.do" enctype="multipart/form-data">
3.js replaces the hyperlink (window.location.href)
<input type="button" id="modify" value="修改工号" onclick="modifyEmp(${ myList.employeeId })"> //js不能起名为modify,为敏感关键字 function modifyEmp( employeeId ){ //employeeId 作为js的参数传递进来 window.location.href = '<%=path%>/User_openUserUpdate?employeeId='+employeeId; }
The above are several ways to submit js that I have compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
Explain in detail the Windows object course in JS
Introduce several types of events in js in detail The way to handle the program
Focus on analyzing and answering the js and el expression operation list
The above is the detailed content of Focus on answering several submission methods of js. For more information, please follow other related articles on the PHP Chinese website!