开发工具:
文件大小: 347kb
下载次数: 0
上传时间: 2011-05-20
详细说明: var startTime; $(document).ready(function () { $("#subButton").click(function () { var myDate = new Date(); startTime = myDate.getTime(); $(this).attr("disabled", true); $("#uploadForm").submit(); $("#progress").show(); window.setTimeout("getProgressBar()", 1000); }); $("#close").click(function(){$("#progress").hide();}); }); function getProgressBar() { var timestamp = (new Date()).valueOf(); var bytesReadToShow = 0; var contentLengthToShow = 0; var bytesReadGtMB = 0; var contentLengthGtMB = 0; $.getJSON("/uploadProgress/getBar", {"t":timestamp}, function (json) { var bytesRead = (json.pBytesRead / 1024).toString(); if (bytesRead > 1024) { bytesReadToShow = (bytesRead / 1024).toString(); bytesReadGtMB = 1; }else{ bytesReadToShow = bytesRead.toString(); } var contentLength = (json.pContentLength / 1024).toString(); if (contentLength > 1024) { contentLengthToShow = (contentLength / 1024).toString(); contentLengthGtMB = 1; }else{ contentLengthToShow= contentLength.toString(); } bytesReadToShow = bytesReadToShow.substring(0, bytesReadToShow.lastIndexOf(".") + 3); contentLengthToShow = contentLengthToShow.substring(0, contentLengthToShow.lastIndexOf(".") + 3); if (bytesRead == contentLength) { $("#close").show(); $("#uploaded").css("width", "300px"); if (contentLengthGtMB == 0) { $("div#info").html("\u4e0a\u4f20\u5b8c\u6210\uff01\u603b\u5171\u5927\u5c0f" + contentLengthToShow + "KB.\u5b8c\u6210100%"); } else { $("div#info").html("\u4e0a\u4f20\u5b8c\u6210\uff01\u603b\u5171\u5927\u5c0f" + contentLengthToShow + "MB.\u5b8c\u6210100%"); } window.clearTimeout(interval); $("#subButton").attr("disabled", false); } else { var pastTimeBySec = (new Date().getTime() - startTime) / 1000; var sp = (bytesRead / pastTimeBySec).toString(); var speed = sp.substring(0, sp.lastIndexOf(".") + 3); var percent = Math.floor((bytesRead / contentLength) * 100) + "%"; $("#uploaded").css("width", percent); if (bytesReadGtMB == 0 && contentLengthGtMB == 0) { $("div#info").html("\u4e0a\u4f20\u901f\u5ea6:" + speed + "KB/Sec,\u5df2\u7ecf\u8bfb\u53d6" + bytesReadToShow + "KB,\u603b\u5171\u5927\u5c0f" + contentLengthToShow + "KB.\u5b8c\u6210" + percent); } else { if (bytesReadGtMB == 0 && contentLengthGtMB == 1) { $("div#info").html("\u4e0a\u4f20\u901f\u5ea6:" + speed + "KB/Sec,\u5df2\u7ecf\u8bfb\u53d6" + bytesReadToShow + "KB,\u603b\u5171\u5927\u5c0f" + contentLengthToShow + "MB.\u5b8c\u6210" + percent); } else { if (bytesReadGtMB == 1 && contentLengthGtMB == 1) { $("div#info").html("\u4e0a\u4f20\u901f\u5ea6:" + speed + "KB/Sec,\u5df2\u7ecf\u8bfb\u53d6" + bytesReadToShow + "MB,\u603b\u5171\u5927\u5c0f" + contentLengthToShow + "MB.\u5b8c\u6210" + percent); } } } } }); var interval = window.setTimeout("getProgressBar()", 500); } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.