Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Automatically click button after certain number of seconds / pause

Posted on 2011-02-28
Medium Priority
Last Modified: 2012-06-27
Hi Experts

I have the following HTML button that I would like to be clicked automatically after 5 seconds. How can I do this?

Here is the code for the button:

<input type="submit" name="proceed" value="Click here to continue to Step 3 - Payment Details" />

And here is the code for the <form> tag for the form in which this button is located:

<form enctype="application/x-www-form-urlencoded" name="cartCheckout" method="POST" action="<%=checkOutURL%>" autocomplete="off">



Question by:wesmanbigmig13
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 82

Expert Comment

ID: 35003009
You should be able to directly use :
window.onload = function() { setTimeout('document.forms["cartCheckout"].submit()', 5000); }

Open in new window


Author Comment

ID: 35003151
Thanks - but do I add this into the <head> section, the <body> tag, or in the main code area for the page?

LVL 82

Accepted Solution

leakim971 earned 2000 total points
ID: 35003163
Test page :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
	window.onload = function() {
		setTimeout('document.forms["cartCheckout"].submit()', 5000);
<form enctype="application/x-www-form-urlencoded" name="cartCheckout" method="POST" action="" autocomplete="off">
	<input type="submit" name="proceed" value="Click here to continue to Step 3 - Payment Details" />

Open in new window

LVL 82

Expert Comment

ID: 35003166
>Thanks - but do I add this into the <head> section, the <body> tag, or in the main code area for the page?

yes, it run at page load, when the page is successfully loaded, the code start counting the five second and submit your form :

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question