dimanche 12 avril 2015

javascript doesn't work in IE (getElementById)

I'm using a form with two submit buttons and JS with 2 functions to use either one.



<form action"" name="submit" id="step_1_form" method="post">
...
<input type="submit" value="Speichern & zurück" class="backbutton" form="absenden" name="saveandback" onClick="saveandback()" />

<input type="submit" value="Speichern & Step 2" class="send" form="absenden" name="saveandfurther" onClick="step2()" />
</form>


JS



form=document.getElementById("step_1_form");
function step2() {
form.action="step2.php";
form.submit();
}
function saveandback() {
form.action="scripts/saveandback.php";
form.submit();
}


It works in Safari, Chrome and Firefox, but not in IE. May you help me to find out which element makes the problem and maybe how to solve it? That would be very nice. Thank you!


Aucun commentaire:

Enregistrer un commentaire