-1

如何修改下面的代码,以便在进度条在后台运行时在框内添加居中的“正在加载...”消息?IE。当进度条在 DIV 内的后台运行时,它将在框的中心显示 LOADING..."。

<!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>
4

1 回答 1

0
    <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>
于 2012-09-19T15:54:42.543 回答