La copie de code est la suivante:
<% @ 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>
<adal>
<Title> Une seule fois qu'une demande peut être envoyée dans un certain délai </Title>
<script type = "text / javascript" src = "$ {pagecontext.request.contextpath} /editor/jquery/jquery-1.4.4.min.js"> </ script>
<meta http-equiv = "contenu-type" contenu = "text / html; charset = utf-8" />
<Script linguisse = "javascript">
var maxtime = 10; // définir au moins 10 pour envoyer une demande
Test de fonction (obj) {
if (obj.value == 'soumi') {
vérifier();
btn = setInterval ("Countdown ()", 1000);
}autre{
alert ("Envoyer une seule fois par minute!");
}
}
Function Countdown () {
if (maxtime> = 0) {
secondes = math.floor (maxtime% 60);
msg = "il y a encore" + secondes + "secondes" à la fin du temps;
$ ("# btn"). Val (msg);
--maxtime;
}autre{
$ ("# btn"). Val ("commit");
ClearInterval (BTN);
maxtime = 10;
}
}
Fonction Check () {
alerte ("haha, c'est moi!");
}
</cript>
</ head>
<body>
<input type = "bouton" id = "btn" value = "soumi" onclick = "test (this)" />
</docy>
</html>