Javascript 添加一个居中的“;“正在加载…”;进度条中的消息
如何修改下面的代码,使我能够在进度条在后台运行时在框内添加一条以中心为中心的“加载…”消息?当进度条在DIV的背景中运行时,它会在框的中心显示LOADING…”Javascript 添加一个居中的“;“正在加载…”;进度条中的消息,javascript,html,Javascript,Html,如何修改下面的代码,使我能够在进度条在后台运行时在框内添加一条以中心为中心的“加载…”消息?当进度条在DIV的背景中运行时,它会在框的中心显示LOADING…” <!DOCTYPE html> <html> <head> <script type="text/javascript"> var prg_width = 200; var progress_run_id = null; function progress() { va
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var prg_width = 200;
var progress_run_id = null;
function progress() {
var node = document.getElementById('progress');
var w = node.style.width.match(/\d+/);
if (w == prg_width) {
clearInterval( progress_run_id );
w = 0;
alert("done")
} else {
w = parseInt(w) + 5 + 'px';
}
node.style.width = w;
}
function runit() {
progress_run_id = setInterval(progress, 30);
}
</script>
</head>
<body>
<div style="border: 1px solid #808080; width:200px; height:20px;">
<div id="progress" style="height:20px; width:0px; background-color:#DBDBDB;"/>
</div>
</div>
<p><a href="javascript:runit()">Start</a></p>
</body>
</html>
var prg_宽度=200;
var progress\u run\u id=null;
函数progress(){
var node=document.getElementById('progress');
var w=node.style.width.match(/\d+/);
如果(w==prg_宽度){
clearInterval(进度\运行\ id);
w=0;
警报(“完成”)
}否则{
w=parseInt(w)+5+'px';
}
node.style.width=w;
}
函数runit(){
进度\运行\ id=设置间隔(进度,30);
}
加载
<div style="border: 1px solid #808080; width:200px; height:20px;">
<div id="progress" style="text-align: center; height:20px; width:0px; background-color:#DBDBDB;"/>
<div style=" position: fixed; left: 92px ">loading</div>
</div>
</div>