-1
为什么此代码无法运行? 我在将文件下载到fileDownloadToken时设置了cookie。如果不是null,则EXEC finishdownload检查...阻止用户界面无法正常工作
<script type="text/javascript">
var fileDownloadCheckTimer;
function blockUIForDownload() {
if (IsCookiesEnable()) {
var token = new Date().getTime(); //use the current timestamp as the token value
$('#token').val(token);
$.blockUI{ message: '', fadeIn: 0 };);
fileDownloadCheckTimer = window.setInterval(function() {
var cookieValue = $.cookie('fileDownloadToken');
// alert(cookieValue);
if (cookieValue != null)
finishDownload();
}, 1000);
}
}
function IsCookiesEnable() {
var cookieEnabled = (navigator.cookieEnabled) ? true : false;
if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled) {
document.cookie = "testcookie";
cookieEnabled = (document.cookie.indexOf("testcookie") != -1) ? true : false;
}
return (cookieEnabled);
}
function finishDownload() {
//window.clearInterval(fileDownloadCheckTimer);
$.cookie('fileDownloadToken', null);
$.unblockUI();
}
可以调试的JavaScript?你能告诉它有一个例外吗? – SoonDead 2013-04-10 09:06:53
请通过告诉我们您的问题到底是什么,以及您认为是什么问题,请定义不起作用。 – Aristos 2013-04-10 09:10:11