导入文件显示进度条

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cxws110/article/details/89205203

<script type="text/javascript">
    $(document).ready(function(){
          $('#impExcel').click(function(){
              var impdata=document.getElementById("impData").value;
              if(impdata==null || impdata==''){
                  alert("请先选择需要上传的文件!");
                  return false;
              }
            $('#swf').html('');
            document.getElementById("bgLayer").style.display="";
            document.getElementById("main").style.display="";
             document.listForm.action="";
             document.listForm.submit();
       });
    }); 
    function yunxing(){
        var result=document.getElementById("result").value;
        var message=document.getElementById("message").value;
        if(result==null || result=="" || result=='undefined'){
            return false;
        }else{
            if(result==0){
                alert(message);
            }
            if(result==1){
                alert(message);
                window.location.href="";
                window.parent.document.getElementById("hkList").contentWindow.chaxun();
            }
        }
    }
    function fanhui(){
        window.location.href="";
    }
</script>
<style type="text/css">
#bgLayer {  
    background: #F9FCFF none repeat scroll 0 0;  
    height: 100%;  
    left:0;  
    top:0;  
    width:100%;  
    filter: alpha(opacity=50); /* IE */  
    -moz-opacity: 0.5; /* Moz + FF */  
    opacity: 0.5;
    z-index: 10000; 

#main {
    background: #DFEFFC;
    position: absolute;
    width:400px;
    height:200px;
    left:50%;
    top:50%;
    margin-left:-200px;
    margin-top:-100px;
    border:2px solid #E5F3FD;
    z-index: 10001; 
}
#title{
    width:300px;
    margin-top:20px;
    margin-left:20px;
    top:50%;
    text-align:left;
    font-size:14;
    font-weight:bold;
    font-family:STHeiti;
    height:30px;

#progress{
    margin-top:20px;
    top:50%;
    text-align:center;
    height:20px;
}
#alertMsg{
    font-size:12;
    margin-top:20px;
    top:50%;
    text-align:center;
    height:50px;
}
</style>
</head>
<body onload="yunxing()">
<div class="panel">
   <div class="panel-body">
           <form id="listForm" name="listForm" action="#" method="post" enctype="multipart/form-data">
          <table id="fk" class="table-grid">
               <tr>
            <th height="25" colspan="2" class="title" align="center"></th>
            </tr>
            <tr>
                  <td width="150" height="25" class="title" align="right">选择Excel文件:</td>
                  <td width="550">
                      <input type="file" id="impData" name="impData" UNSELECTABLE="on" size="55" dataType="Notnull" msg="必须选择要导入的Excel文件!"><FONT color=#ff0000>*</FONT>
                  </td>
             </tr>
           <tr>
                  <td width="150" height="25" class="title" align="right">填表说明:</td>
                  <td>
                      <br>
                          
                       <br>
                  </td>
            </tr>
            <tr>
                <td height="25" colspan="2" class="button" align="center">
                    <input type="button" class="btn6"  id="impExcel" value="导入Excel回款匹配数据"/>&nbsp;&nbsp;
                    <input type="button" value="返回" onClick="fanhui()"/>
                    <input type="hidden" id="result" value="${result}"/>
                    <input type="hidden" id="message" value="${message}"/>
                </td>
            </tr>
        </table>
           </form>
           <div id="bgLayer" style="position:absolute; display: none;"></div>
        <div id="main" style="display: none;">
            <div id="title">
                文件上传...
            </div>
            <div id="progress">
                <img src="${ctx}/commons/image/loading1.gif"/>
            </div>
            <div id="alertMsg">
                文件正在上传,此过程需要几分钟时间...<br>在此提示框关闭前,请不要做其他操作!
            </div>
        </div>
    </div>
</div>
</body>

猜你喜欢

转载自blog.csdn.net/cxws110/article/details/89205203
今日推荐