Author Topic: How to Submit a Form Using JavaScript  (Read 5380 times)

Offline admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 296
    • View Profile
How to Submit a Form Using JavaScript
« on: April 03, 2009, 01:21:56 AM »
How to Submit a Form Using JavaScript

Suppose you want to submit a form when the user clicks on a hyperlink. The code below shows how to do it.

Code: [Select]
<form name="myform" action="handle-data.php">
Search: <input type='text' name='query'>
<A href="javascript: submitform()">Search</A>
</form>
<SCRIPT language="JavaScript">
function submitform()
{
  document.myform.submit();
}
</SCRIPT>