코드 사본은 다음과 같습니다.
<%@ 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>
<헤드>
<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 == '제출') {
확인하다();
btn = setInterVal ( "countdown ()", 1000);
}또 다른{
Alert ( "1 분에 한 번만 보내십시오!");
}
}
함수 countdown () {
if (maxtime> = 0) {
초 = Math.floor (Maxtime%60);
msg = "시간이 끝나면"+초+"초"가 있습니다.
$ ( "#btn"). val (msg);
-마시 타임;
}또 다른{
$ ( "#btn"). val ( "Commit");
ClearInterval (BTN);
maxtime = 10;
}
}
함수 check () {
경고 ( "하하, 나야!");
}
</스크립트>
</head>
<body>
<입력 유형 = "button"id = "btn"value = "제출"onclick = "test (this)"/>
</body>
</html>