시나리오는 폼 요소에서 자동 새로 고침 기능을 작성한 것이고 자동 새로 고침 기능을 사용하지 않으려면 로그인 버튼에서 onclick 이벤트를 원합니다.jquery 폼 요소 사용 안 함
자동 새로 고침을 사용 중지 할 수 없으며 페이지가 계속 새로 고침됩니다.
내 코드는 다음과 같습니다
$('#form').ready(function() { //Increment the idle time counter every minute.
var idleInterval = setInterval("timerIncrement()", 15000); // 1 minute
//Zero the idle timer on mouse movement.
$(this).mousemove(function (e) {
idleTime = 0;
});
$(this).keypress(function (e){
idleTime = 0;
});
});
function timerIncrement() {
idleTime = idleTime + 1;
if (idleTime > 2) { // 20 minutes
window.location.reload();
}
}
$('#login').ready(function() {
alert("working promptly");
//Zero the idle timer on mouse movement.
$(this).click(function (e) {
alert("Hi In click !");
$('#form').attr("disabled","true");
});
});
'에서는 setInterval ("timerIncrement는()", 15000)'는'되어야한다 setInterval ("timerIncrement", 15000); and omg, 스크립트에서 몇 개의 오류를 만들 수 있습니까? – Val
사실, 그것은'setInterval (timerIncrement, 15000);'이어야합니다 -'eval is evil! –
@anu 이것은 매우 일반적인 문제이며,'attr' 대신'prop'를 사용하면 작동 할 것입니다. – noob