Html: Tricks: How to Automate submitting forms Method One: <title>untitled document</title>
(1) Automatic submission of the form:
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<script language=javascript>
SetTimeout ("Document.form1.submit ()", 10000)
</script>
<body bgcolor= "#FFFFFF" text= "#000000" >
<form name= "Form1" method= "Post" action= "pp.asp" >
<p>
<input type= "text" name= "TextField" >
</p>
<p>
<input type= "text" name= "Textfield2" >
</p>
</form>
</body>
10 seconds to submit.
---------------------------------------------------------------------------------------------------------
Method Two: I want to open a page a.htm when the form of a form to the server b.htm submit data, as if to apply for 100 mailboxes, you can achieve it.
---------------------------------------------------------------------------------------------------------
Using Window.setinterval and window.clearinterval operations, such as the following script is implemented:
<script language= "Javascript" >
var formobj=document.forms["FormName"];
var sobj;
Set the maximum number of automatic commits
var max=100;
Form Submit function
function SubmitForm ()
{
if (formobj&&max>0)
{
formobj.action= "b.htm"//submitted to the page
Formobj.target= "_blank";//Submit with new window
Formobj.submit ()//Execute Commit
max--;
}
Else
Submitint ();
}
Interrupt Auto-Submit function
function Submitint ()
{
if (sobj)
{
Window.clearinterval (Sobj);
max=100;
}
}
Start Auto Submit function
function Submitstart ()
{
Set submit form once per second
Sobj=window.setinterval ("SubmitForm ()", 1000);
}
</script>
You can set up two buttons on the page to perform Submitstart () Start, Submitint () to terminate. where "FormName" is single-name for the table to be submitted. Also note that the script is placed behind the form.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.