I am trying to submit using javascript . Since I was not able to find using “document.forms” so i used “document.getElementById” but now i am not able to assign action class to it .Can someone help me on this .
My code :
<html>
<head>
just to check javascript form submission
</head>
<body>
<script>
function formsubmission(value){
alert("i am here just before the form submission"+value);
document.forms["ashutosh"].submit();
alert("i am just after the form submission");
}
</script>
<form id="ashutosh" action="http://www.gmail.com">
<select onchange="javascript:formsubmission(this.formName)">
<option value="1">ashutosh</option>
<option value="2">ashutosh1</option>
<option value="3">ashutosh2</option>
</select>
</form>
</body>
</html>
Error :
Object #<HTMLElement> has no method 'submit'
Much simpler:
Demo: http://jsfiddle.net/mattball/N4fxn/