This article mainly describes how to set a certain time to send only one request, the need for friends can refer to the following
Code as follows: <%@ page language= "java" contenttype= "text/html; Charset=utf-8 " pageencoding=" UTF-8 "%> <% @taglib prefix=" C "uri=" http://java.sun.com/jsp/jstl/ Core "%> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" > <html > <head> <title> A certain period of time, can only send a request </title> <script type= "Text/javascript" src = "${pagecontext.request.contextpath}/editor/jquery/jquery-1.4.4.min.js" ></script> <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/> <script language=" JavaScript "> var maxtime = 10;//set at least 10 to send once request function Test (obj) { if (obj.value== ' submit ') { check (); btn = SetInterval ("Countdown ()", 1000); }else{ Alert ("Can only be sent once in a minute!") "); } } function countdown () { if (maxtime>=0) { seconds = Math.floor (maxtime%60); msg = "Distance time end also" +seconds+ "Seconds"; $ ("#btn"). Val (msg); --maxtime; }else{ $ (" #btn "). Val (" submit "); Clearinterval (btn); maxtime = 10; } } function check () { alert ("Haha, come to me!" "); } </SCRIPT> </head> <body> <input type=" button "id=" BTN " Value= "Submit" onclick= "test (This)"/> </body> </html>