如何实现刷新倒计时效果?

如何实现刷新倒计时效果


慕慕森
浏览 671回答 2
2回答

万千封印

可以循环计时,而对于页面刷新,我们可以屏蔽鼠标右键、Ctrl+N、Shift+F10、Alt+F4、F11、F5刷新、退格键来达到效果<script>//屏蔽鼠标右键、Ctrl+N、Shift+F10、F11、F5刷新、退格键function document.oncontextmenu(){event.returnValue=false;}//屏蔽鼠标右键function window.onhelp(){return false} //屏蔽F1帮助function document.onkeydown(){if((window.event.altKey)&&((window.event.keyCode==37)||(window.event.keyCode==39))){//屏蔽Alt+方向键←//屏蔽Alt+方向键→event.returnValue=false;}if((event.keyCode==8)||(event.keyCode==116)||(event.ctrlKey && event.keyCode==82)){//屏蔽退格删除键//屏蔽F5刷新键//Ctrl+Revent.keyCode=0;event.returnValue=false;}if(event.keyCode==122){event.keyCode=0;event.returnValue=false;} //屏蔽F11if(event.ctrlKey && event.keyCode==78)event.returnValue=false; //屏蔽Ctrl+nif(event.shiftKey && event.keyCode==121)event.returnValue=false; //屏蔽shift+F10if(window.event.srcElement.tagName=="A" && window.event.shiftKey)window.event.returnValue=false; //屏蔽shift加鼠标左键新开一网页if((window.event.altKey)&&(window.event.keyCode==115)){ //屏蔽Alt+F4window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");return false;}}</script>

有只小跳蛙

$(function(){var time = $.cookie("time");if(time==null){$.cookie("time",200);time=$.cookie("time");}$("input").val(time);setTimeout(Round(),1000) ;})function Round(){$("input").val($.cookie("time"));$.cookie("time")=$.cookie("time")-1;setTimeout(Round(),1000) ;}<input></input>
打开App,查看更多内容
随时随地看视频慕课网APP