60 lines
1.5 KiB
JavaScript
60 lines
1.5 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 printX() {
|
|||
|
|
var userid = document.getElementById('id-inputEl').value;
|
|||
|
|
F.ui.Window2.show();
|
|||
|
|
parse(0);
|
|||
|
|
var begin = setInterval(function () {
|
|||
|
|
PageMethods.getPercent(userid,function (result) {
|
|||
|
|
parse(result);
|
|||
|
|
if (result >= 100) {
|
|||
|
|
F.ui.Window2.hide();
|
|||
|
|
clearInterval(begin);
|
|||
|
|
print();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}, 1000 );
|
|||
|
|
y = 0;
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
function print() {
|
|||
|
|
PageMethods.
|
|||
|
|
setTimeout(function () {
|
|||
|
|
var message = document.getElementById('message-inputEl').value;
|
|||
|
|
console.log(message);
|
|||
|
|
notify(message);
|
|||
|
|
}, 1000); // 1000毫秒,即1秒
|
|||
|
|
}
|
|||
|
|
// 通知框
|
|||
|
|
function notify(msg) {
|
|||
|
|
F.notify({
|
|||
|
|
message: msg,
|
|||
|
|
messageIcon: 'information',
|
|||
|
|
target: '_top',
|
|||
|
|
header: false,
|
|||
|
|
displayMilliseconds: 3 * 1000,
|
|||
|
|
positionX: 'center',
|
|||
|
|
positionY: 'center'
|
|||
|
|
});
|
|||
|
|
}
|