نسخة الكود كما يلي:
<٪@ 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> بمجرد إرسال الطلب في غضون فترة زمنية معينة </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 ؛ // تعيين 10 على الأقل لإرسال طلب
اختبار الوظيفة (OBJ) {
if (obj.value == 'submit') {
يفحص()؛
btn = setInterval ("countdown ()" ، 1000) ؛
}آخر{
تنبيه ("أرسل مرة واحدة فقط في دقيقة!") ؛
}
}
وظيفة العد التنازلي () {
if (maxtime> = 0) {
ثواني = Math.Floor (Maxtime ٪ 60) ؛
msg = "لا يزال هناك"+ثواني+"ثواني" عندما ينتهي الوقت ؛
$ ("#btn"). val (msg) ؛
-Maxtime ؛
}آخر{
$ ("#btn"). val ("الالتزام") ؛
Clearinterval (BTN) ؛
maxtime = 10 ؛
}
}
وظيفة check () {
في حالة تأهب ("هاها ، أنا!") ؛
}
</script>
</head>
<body>
<type type = "button" id = "btn" value = "submit" onClick = "test (this)"/>
</body>
</html>