71 lines
1.7 KiB
JavaScript
71 lines
1.7 KiB
JavaScript
|
||
function parse(y) {
|
||
var box = document.getElementById("box");
|
||
//获取进度条div的宽度
|
||
var x = box.style.width;
|
||
x = parseInt(x) + 1;
|
||
y = y + 1;
|
||
//将y值加上百分号赋值给box的宽度。这样每次+1就可以实现进度条占父容器的100%;
|
||
box.style.width = y + "%";
|
||
//将y值加上百分号并赋值给显示下载百分比的div上
|
||
document.getElementById("box").innerHTML = y + "%";
|
||
//判断当y已经100的时候,也就是进度条的宽度和父容器的宽度一致的时候停止。
|
||
if (y >= 100) {
|
||
|
||
document.getElementById("box").innerHTML = "100%";
|
||
}
|
||
}
|
||
|
||
|
||
|
||
function downFile() {
|
||
var begin = setInterval(function () {
|
||
PageMethods.getUrl(function (res) {
|
||
if (res != "") {
|
||
window.open("../" + res);
|
||
clearInterval(begin);
|
||
F.ui.Window1.hide();
|
||
}
|
||
|
||
});
|
||
}, 1000);
|
||
}
|
||
|
||
function printX() {
|
||
|
||
parse(0);
|
||
var begin = setInterval(function () {
|
||
PageMethods.getPercent(function (result) {
|
||
console.log(result);
|
||
parse(result);
|
||
if (result >= 100) {
|
||
|
||
downFile();
|
||
clearInterval(begin);
|
||
}
|
||
});
|
||
}, 1000);
|
||
|
||
|
||
y = 0;
|
||
//<![CDATA[
|
||
var theForm = document.forms['form1'];
|
||
if (!theForm) {
|
||
theForm = document.form1;
|
||
}
|
||
// theForm.__EVENTTARGET.value = 'RegionPanel1$Region1$Form2$Toolbar1$btnPrint';
|
||
theForm.target = "_blank";
|
||
//theForm.submit();
|
||
theForm.target = "";
|
||
|
||
//]]>
|
||
|
||
|
||
}
|
||
var laterOnSecond = setInterval(function () {
|
||
PageMethods.getPercent(function (result) {
|
||
printX();
|
||
clearInterval(laterOnSecond);
|
||
});
|
||
}, 1000);
|