Monday, May 13, 2024
95
rated 0 times [  96] [ 1]  / answers: 1 / hits: 45131  / 14 Years ago, mon, september 6, 2010, 12:00:00

The following works fine in Firefox and Chrome, but IE 8 will not call the submit() method when the anchor link is clicked.



<a href=javascript:void(0); onclick=submit();>Sign In</a>


The submit method is defined on the same page as follows:



<head>
<script type=text/javascript>

function submit()
{
// other code
document.forms[0].submit();
}

</script>
</head>

More From » internet-explorer

 Answers
73

Can you provide a bit more context? Such as where and how the submit function is defined? With just the above, it should work -- except:



You probably also want to return false; in there though, to cancel the default action. E.g.:



<a href=javascript:void(0); onclick=submit();return false;>Sign In</a>


It may be that the default action is happening immediately after the submit and interfering with it.



Edit: Just for fits and giggles, try using a different name for your submit function. IE has namespacing issues. If you have anything with the id or name attribute set to submit, for instance, that could be an issue...


[#95691] Friday, September 3, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tatumm

Total Points: 47
Total Questions: 92
Total Answers: 89

Location: Palau
Member since Tue, May 30, 2023
1 Year ago
;