-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