Henk Z Henk Z - 3 months ago 16
HTML Question

JavaScript form submit does not work in Firefox

I use the following script and it is working well for other browsers, but it does not work in Firefox.

What does not work, is when clicking on the

<a href>
.

How can I solve this?



function submitform() {
document.forms["serverlogin"].submit();
}

<a class="pakb-box" href="javascript: submitform()" target="_blank">
<p class="pakb-box-icon"><i class="icon-webadresgegevens"></i></p>
</a>
<form id="serverlogin" action="http://example.com" method="post" target="_blank">
<input name="token" value="1234567890" type="hidden">
<input name="SESSID" value="1234567890" type="hidden">
<input name="PHPSESSID" value="1234567890" type="hidden">
<input value="Open" type="submit">
</form>




Answer

try this

remove the href attribute . and put onclick instead

<a class="pakb-box" onclick="submitform()" target="_blank"> 

instead of

 <a class="pakb-box" href="javascript: submitform()" target="_blank">
Comments