RSS

JavaScript Submitted Form

Thu, Jul 23, 2009

Code, JavaScript

Simply this is the code for calling JavaScript to submit a form. One good use is in case you want your submit button to be an anchored image and not a regular form button. You can attach this function to the link/ image and let it do its thing. I am currently learning Ajax so I am using the script to submit my form but not redirect or refresh the page.

document.forms['myForm'].onsubmit = function() {
       // Your code
}

Or

document.forms[0].onsubmit = function() {
       // Your code
}
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • MySpace
  • Twitter
  • Yahoo! Buzz
  • PDF
  • Reddit
  • Slashdot
  • Technorati
, ,

Leave a Reply