How can I submit a form using JavaScript? Set the name attribute of your form to "theForm" and your code will work.