The headline might say a little pompous 0.o
In the previous page, the Submit button in the form form was written
<type= "Submit"/>
However, always feel that there is no easy-to-set style, so write a JS function to convert the a tag to the Submit button.
First on the code:
JS Code:
The A tag can be used to submit a form (form) JS function // Applies to multiple submit cases in a form function Tosubmit (action_str) { ); if (Action_str==null ) {Myform.submit (); else {myform.action = Action_str; Myform.submit (); return false;
How to use:
<formAction= "Action Address"class= "MyForm"ID= "MyForm"> <inputname= "Searchcontent"value= "${searchcontent}"type= "text" /> <Divclass= "Search-list"> <ahref="#"class= "Search-btn"onclick= "Tosubmit (' Action Address 1 ')">Search 1</a> <ul> <Li><ahref="#"onclick= "Tosubmit (' Action Address 2 ')">Search 2</a></Li> <Li><ahref="#"onclick= "Tosubmit ()">Search 3</a></Li> </ul> </Div> </form>
Description
1. Set the href in the A tag to "#";
2. Set Oclick to invoke the JS function, and if you fill in the parameters, jump to the specified action
3. Default if no parameter is jump to form action
"JS Notes" Magic JS to convert a tag to a super-strong submit button