Link to home
Start Free TrialLog in
Avatar of ecla
ecla

asked on

DHTML: Submit form in a DIV tag returns a page not found error

<DIV onClick="document.form1.submit();">Test</DIV>

When I click on that particular DIV, it redirects me to a "undefined" page. That why i get a page not found error. But when I do a alert(document.form1.action) before the submit command. It returns the correct page. If I put the same javascript on a different control for e.g. a button, it works fine.
ASKER CERTIFIED SOLUTION
Avatar of venkateshwarr
venkateshwarr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of javedsiddiqui
javedsiddiqui

Your search criteria for google is invalid u need to set the name attribute with correct keywor here u go with the right result keyword.

<form action="http://www.google.com/search" name=form1>
  <input type=hidden name=q value=a>
</form>
<DIV onClick="document.form1.submit();">Test</DIV>