所以我为测验做了一些计时器.问题是,我刚刚意识到我放的时候
javascript: alert("blah");
Run Code Online (Sandbox Code Playgroud)
在地址中,弹出警告框暂停我的计时器.在测验中这是非常不需要的.
我认为没有办法阻止这种行为......但无论如何我都会问.
如果没有,请记住我应该怎么做?
Fil*_*ini 10
永远不要依赖javascript(或任何其他客户端时间)来计算回发或不同页面之间完成的操作所经过的时间.
如果您总是比较服务器日期,那么人们很难作弊:
显然,预览渲染与发布的渲染不同.这一段是为了确保接下来的两行显示为代码.
// Preserve native alert() if you need it for something special
window.nativeAlert = window.alert;
window.alert = function(msg) {
// Do something with msg here. I always write mine to console.log,
// but then I have rarely found a use for a real modal dialog,
// and most can be handled by the browser (like window.onbeforeunload).
};
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6208 次 |
最近记录: |