Jump to content
deserty

dosubmit javascript once

Recommended Posts

Posted

Stiu ca e simplu, am cautat pe google dar nu am gasit.

Am urmatorul script :

<script language="Javascript">

function doSubmit()

{

document.trebuie.submit.click();

}

setTimeout("doSubmit()",3000);

</script>

Care face submit la un form dupa 3 secunde.

Intrebarea mea este cum pot face ca sa isi dea o singura data submit?

Codul care e scris mai sus da submit la fiecare 3 secunde.

Posted (edited)

Incearca ceva de genul. Eu am testat asa:


<form action="http://www.google.de/" method="GET" name="TheFuckingForm">
<input type="submit">
</form>

<script type="text/javascript">
var asteapta = 10;
function timp(){
if(asteapta >=0) {
asteapta=asteapta-1;
setTimeout("timp()",1000);
} else {
asteapta = 0;
document.TheFuckingForm.submit();
}
}
timp();
</script>

Inspira-te din functia facuta. (timeout este 10 sec. in exemplul dat)

//edit: se pare ca nu functioneaza, face la fel, submit la fiecare Xnr. secunde. Cred ca poti pune pe body onload cumva.

Edited by aelius
Posted (edited)

Nu inteleg de ce nu merge.

Am ceva de genul :


<form action="www.google.ro" method="POST" enctype="multipart/form-data" name="trebuie">
<input type="submit" name='submit' class="button-submit" value="Submit Query" />
</form>

<script type="text/javascript">
var asteapta = 10;
function timp(){
if(asteapta >=0) {
asteapta=asteapta-1;
setTimeout("timp()",1000);
} else {
asteapta = 0;
document.trebuie.submit();
}
}
timp();
</script>

In form mai am multe inputuri dar nu cred ca are legatura.

Iar in aceeasi pagina mai am form-uri la care nu le-am dat name.

LE: Nu pot pune body onload. Pentru ca am cateva functii cu get_string_between, uneori rezultatul mi-l afiseaza mai greu, iar daca pun on body load e posibil ca inputurile sa mi le proceseze ca fiind goale.

Sper ca ma exprim corect, dar sunt obosit.

LE2: Deci nu ma poate ajuta nimeni ?

Edited by deserty

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...