超时发生后页面提交中的问题 [英] Problem in Page Submission after a time out occur

查看:59
本文介绍了超时发生后页面提交中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个测验考试,其中在指定的超时后发生表单提交,并带有一个带OK按钮的警告消息。问题是,当超时发生并按下OK按钮后,超时警报会一次又一次地显示,直到页面重定向到结果页面。

我希望它显示一次,然后页面将被获取提交。

Button2是我的提交按钮,分钟是一个时间变量,只需几分钟。

请帮助我!





I have a quiz exam in which form submission occurs after the specified time out with an alert message with OK button. Problem is that when time out occurs and after pressing OK button, time out alert is displaying again and again until the page redirected to result page.
I want it to show once and then the page to be get submitted.
Button2 is my submit button and mins is a variable for time in minutes.
Please help me !


Literal1.Text = "<script>$(function(){ var note = $('#note'), ts = new Date(2012, 0, 1),newYear = true; if((new Date()) > ts){	ts = (new Date()).getTime() + " + mins + "*60*1000; newYear = false;	}	$('#countdown').countdown({	timestamp	: ts,callback	: function(days, hours, minutes, seconds){   var message = ''; var timer = ''; message += days + ' day' + ( days==1 ? '':'s' ) + ', '; message += hours + ' hour' + ( hours==1 ? '':'s' ) + ', '; message += minutes + ' minute' + ( minutes==1 ? '':'s' ) + ' and '; message += seconds + ' second' + ( seconds==1 ? '':'s' ) + ' <br />';	timer = hours + ':' + minutes + ':' + seconds;	note.html(timer); if (minutes.toString() == '0' && seconds.toString() == '0') {$('#note').attr('id', '#note1');	  alert('Time up');	   $('#Button2').click();    return;	}	} }); });</script>";





HTML代码



HTML Code

<table>
     <tr>
        <td style="padding-left:15px;">Time Left :</td>
        <td>
        <p id="note" style="height: 24px; line-height: 38px;"></p>
        </td>
     </tr>
</table>
<script type="text/javascript">
//$('input:submit').click(function () {
//$('input:submit').attr("disabled", true);
//});
var clicked = false;
function DisableButton() {
   if (clicked == false) {
     clicked = true;
     //var btn = $("#Button2");
     //btn.value = "Processing";
     //$('#Button2').text("Processing");
     //alert("Submitted");
     return true;
   }
   else { 
     alert("Submitted");
     $("#note").attr("id", "#note1");
     //$('#Button2').text("Processing");
     return false;
    }
 }
</script>
<asp:Button ID="Button2" runat="server" CssClass="gbutton"  Text="Submit" OnClientClick="return DisableButton();" OnClick="Button2_Click" BorderStyle="Outset" />

推荐答案

(function(){var note =
(function(){ var note =


('#note'),ts = new Date(2012,0,1),newYear = true; if((new Date())> ts){ts =(new Date())。getTime()+ + mins + < span class =code-string> * 60 * 1000; newYear = false; }
('#note'), ts = new Date(2012, 0, 1),newYear = true; if((new Date()) > ts){ ts = (new Date()).getTime() + " + mins + "*60*1000; newYear = false; }


('#countdown')。countdown({timestamp:ts,callback:function(days,hours,minutes,seconds){var message =''; var timer ='' ;消息+ =天+'天'+(天= = 1?'':'s')+',';消息+ =小时+'小时'+(小时== 1?'':'s') +',';消息+ =分钟+'分钟'+(分钟== 1?'':'s')+'和';消息+ =秒+'秒'+(秒== 1?'': 's')+'< br />';计时器=小时+':'+分钟+':'+秒; note.html(计时器); if(minutes.toString()=='0'& ;& seconds.toString()=='0'){
('#countdown').countdown({ timestamp : ts,callback : function(days, hours, minutes, seconds){ var message = ''; var timer = ''; message += days + ' day' + ( days==1 ? '':'s' ) + ', '; message += hours + ' hour' + ( hours==1 ? '':'s' ) + ', '; message += minutes + ' minute' + ( minutes==1 ? '':'s' ) + ' and '; message += seconds + ' second' + ( seconds==1 ? '':'s' ) + ' <br />'; timer = hours + ':' + minutes + ':' + seconds; note.html(timer); if (minutes.toString() == '0' && seconds.toString() == '0') {


这篇关于超时发生后页面提交中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆