Jump to content
deserty

Submit form javascript

Recommended Posts

Posted

Am un form de genul


<form name="input" action="" method="post">
<input type="text" name="1"/>
<input type="submit" value="Submit" />
</form>

Iar alt form


<form name="send" action="www.xxx.ro/pagina.php" method="post">
<input type="text" name="2"/>
<input type="submit" value="Submit" />
</form>

As avea nevoie de un cod in javascript care sa dea submit dupa 2 secunde automat la form-ul "send", asta dupa am dat eu submit la primul form.

Posted

Ca sa dai submit, alege una dintre variantele:

<form id="form" name="send" action="http://www.google.ro/" method="post">
<input type="text" name="2"/>
<input name="buton" id="btn" type="submit" value="Submit" />
</form>

<script>
document.forms[0].submit();
document.send.submit();
document.getElementById("form").submit();

// Sau apesi butonul

document.forms[0].buton.click();
document.send.buton.click();
document.getElementById("btn").click();
</script>

Ca sa dai submit dupa 2 secunde:

<script>

// Functie care da submit

function Dupa2Secunde()
{
document.forms[0].submit();
}

// Apel dupa 2 secunde

setInterval(Dupa2Secunde, 2000);

</script>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...