html部分的代碼
html結合javascript實現的進度條<table>
html結合javascript實現的進度條            
<tr>
html結合javascript實現的進度條            
<td width=80 align=right>執行進度</td>
html結合javascript實現的進度條            
<td width=200 height=20>
html結合javascript實現的進度條                
<fieldset style="background:#eeeeee" id=fieldBar>
html結合javascript實現的進度條                    
<table id=proccessBar cellSpacing="0" cellPadding="0" border=0>
html結合javascript實現的進度條                        
<tr height="10">
html結合javascript實現的進度條                            
<td width=1></td>
html結合javascript實現的進度條                        
</tr>
html結合javascript實現的進度條                    
</table>
html結合javascript實現的進度條                
</fieldset>
html結合javascript實現的進度條            
</td>
html結合javascript實現的進度條            
</tr>
html結合javascript實現的進度條        
</table>
html結合javascript實現的進度條
<input type="button" value="列    印" id="rpt" name="rpt1" onclick="showrpt()">&nbsp;&nbsp;
html結合javascript實現的進度條
<input type="button" value="返    回" id="exitbutton" name="exitbutton" onclick="window.close();">
html結合javascript實現的進度條
javascript部分的代碼
html結合javascript實現的進度條function showrpt()
html結合javascript實現的進度條{
html結合javascript實現的進度條    
var nodes=checkdoc.selectNodes("//option");
html結合javascript實現的進度條    
if (nodes==null || nodes.length==0){alert('無任何紀錄!');return;}
html結合javascript實現的進度條    rpt.disabled
=true;
html結合javascript實現的進度條    len
=nodes.length+1
html結合javascript實現的進度條    proccessBar.childNodes(
0).childNodes(0).childNodes(0).width=parseInt(200/len,10)
html結合javascript實現的進度條    
for (var i=1;i<len;i++)
html結合javascript實現的進度條    {
html結合javascript實現的進度條        proccessBar.childNodes(
0).childNodes(0).appendChild(proccessBar.childNodes(0).childNodes(0).childNodes(0).cloneNode(0))
html結合javascript實現的進度條    }
html結合javascript實現的進度條    lnodes
=checkdoc.selectNodes("//option");
html結合javascript實現的進度條    count
=0
html結合javascript實現的進度條    filename
=(new Date()).getTime()
html結合javascript實現的進度條    start();
html結合javascript實現的進度條}
html結合javascript實現的進度條
html結合javascript實現的進度條
function start(){
html結合javascript實現的進度條   
if(count<len-1){
html結合javascript實現的進度條    
var ipport=lnodes(count).getAttribute("ip")
html結合javascript實現的進度條    
var compid=lnodes(count).getAttribute("compid")
html結合javascript實現的進度條    
var compdesc=lnodes(count).getAttribute("compdesc")
html結合javascript實現的進度條    
var compname=lnodes(count).getAttribute("compname")
html結合javascript實現的進度條    
var today=new Date();
html結合javascript實現的進度條    xmlhttp1.Open(
"POST","amcxlstoreXML.asp?compname="+compname+"&filename="+filename+"&ipport="+ipport+"&compid="+compid+"&compdesc="+compdesc+"&now="+today+"&fpartno="+fpartno.value +"&tpartno="+tpartno.value +"&fpartdesc="+fpartdesc.value +"&fvendno="+fvendno.value +"&tvendno="+tvendno.value + "&fvendname="+fvendname.value +"&fppartno="+fppartno.value +"&tppartno="+tppartno.value+ "&fstoretype="+fstoretype.value +"&tstoretype="+tstoretype.value, false);
html結合javascript實現的進度條    xmlhttp1.Send();
html結合javascript實現的進度條    
var strres=xmlhttp1.responseText
html結合javascript實現的進度條    
if(strres.substring(0,2)=="ok")
html結合javascript實現的進度條    {
html結合javascript實現的進度條        proccessBar.childNodes(
0).childNodes(0).childNodes(parseInt(count,10)).style.background="blue"
html結合javascript實現的進度條        complist
=complist+strres.substring(2,strres.length)+"|"
html結合javascript實現的進度條    }
else{
html結合javascript實現的進度條        proccessBar.childNodes(
0).childNodes(0).childNodes(parseInt(count,10)).style.background="blue"
html結合javascript實現的進度條        alert(
"無法從"+compdesc+"的帳別"+compid+"取得數據!"+"\n錯誤代碼:"+strres)
html結合javascript實現的進度條        }
html結合javascript實現的進度條    count
=count+1
html結合javascript實現的進度條    setTimeout(
"start()",50)
html結合javascript實現的進度條    }
else{
html結合javascript實現的進度條    setTimeout(
"getXML()",50)
html結合javascript實現的進度條    }
html結合javascript實現的進度條    
html結合javascript實現的進度條}
html結合javascript實現的進度條
html結合javascript實現的進度條
function getXML(){
html結合javascript實現的進度條    
var today=new Date();
html結合javascript實現的進度條    xmlhttp1.Open(
"POST","amcgetstanXML.asp?tempfile="+filename+"&stanfile=amcxlstore&now="+today, false);
html結合javascript實現的進度條    xmlhttp1.Send();
html結合javascript實現的進度條    
var strres=xmlhttp1.responseText;
html結合javascript實現的進度條    
if(strres.substring(0,2)=="ok"){
html結合javascript實現的進度條        proccessBar.childNodes(
0).childNodes(0).childNodes(parseInt(len-1,10)).style.background="blue"
html結合javascript實現的進度條    }
else{
html結合javascript實現的進度條        alert(
"轉換xml文件失敗!"+"\n錯誤代碼:"+strres);
html結合javascript實現的進度條        
return
html結合javascript實現的進度條    }
html結合javascript實現的進度條    
//alert(complist);return;
html結合javascript實現的進度條
    window.showModalDialog("amcsqlsearchrpt.asp?rptfile=amcxlstore.rpt&para1="+complist+"&now="+today,null,"status=0;dialogHeight="+window.screen.availHeight+"px;dialogwidth=1500 px;dialogtop=0;dialogleft=0;help=0");
html結合javascript實現的進度條}
在上面的三個javascript方法中showrpt最先被觸發,執行到start中時,將依次填充進度條,根據任務的次數len(len既是任務的次數,也表示進度條的步進刻度),以及記數器count來判斷是否循環執行start來繼續填充進度條或執行最後一步getXML.
其效果如下圖
html結合javascript實現的進度條

相关文章: