I have a submit button outside the form. There is no way to place it within the form. I want to change the "action" attribute of the form via JS.
HTML:
<input type="button" value="Excel Export" onclick="excel_export('form_input','page2_xlsx.php')" />
JS:
function excel_export($formname,$formaction)
{
document.getElementsByName($formname)[0].formAction = $formaction;
document.getElementsByName($formname)[0].submit();
}
But this doesn't change the formaction and the action-page is still page2.php
What's wrong with my code?
Thanks!