<%@include file="/auth.jsp"%> <%@page language="java" pageEncoding="utf-8" %> <jsp:useBean id="getPara" scope="application" class="com.zky.para.SyncPara"/> <% String photo=""; %> <html> <head> <title>批量导入</title> <link href="../css/font.css" rel="stylesheet" type="text/css"> <script src="../js/date.js"></script> <script src="../js/check.js"></script> <script> function check(operate) { form1.operate.value = operate; if(form1.photo.value=='') { alert('上传文件不能为空'); return false; } //form1.button1.disabled=true; form1.submit(); } //获得文件的后缀名 function getExtensionName(fileName){ var index=fileName.lastIndexOf("."); if(index==-1) return ""; return fileName.substr(index+1); } function doCheckFile(){ var myFile=document.getElementById("photo"); var eName=getExtensionName(myFile.value); if(eName=="") { alert('文件名不合法!'); return false; } var re=/xls/; //验证后缀名的正则表达式 if(!re.test(eName)){ alert('只能上传后缀名为.xls的文档'); return false; } return true; } </script> <style type="text/css"> .aselect { width:155px; } </style> <style type="text/css"> .td1{ width: 30%; } table#csstable{ border-top:#D8E9FE 1px solid; border-left:#D8E9FE 1px solid; } table#csstable td{ border-bottom:#D8E9FE 1px solid; border-right:#D8E9FE 1px solid; } table#csstable #bottomcss td{ border-bottom:#D8E9FE 0px solid; } .line { position:relative; float:left; padding:2px 0} .line span { float:left} .file { position:absolute; left:20px; top:3px; display:none;filter:alpha(opacity=0);opacity:0} .file1 {font-size: 12px; color: #000000; width:56px; text-decoration: none; background-image: url(/images/anniu_bg1.gif); border: 1px solid; margin-top:2px; padding: 1px; cursor:hand;} .inputstyle { width:150px; border:1px solid #888; z-index:99;} </style> </head> <body onload="setValue();"> <br> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" class="box"> <tr> <td valign="top"><table width="100%" height="23" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="25%" background="/images/tab_search_01.jpg"><table width="80%" height="23" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="3%"><img src="/images/little_red.jpg" width="12" height="12"></td> <td width="97%" class="font12b"> 文件管理</td> </tr> </table></td> <td width="82%" background="/images/tab_search_03.jpg"><img src="/images/tab_search_02.jpg" width="12" height="23"></td> </tr> </table> <form name="form1" method="post" enctype="multipart/form-data" action="/servlet/ImportExcelServlet"> <input type="hidden" name="operate"/> <br> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="3%"><img src="/images/little.gif" width="12" height="12"></td> <td width="97%" class="font12">导入文件选择</td> </tr> </table> <table width="90%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="d8e9fe" class="table02"> <tr bgcolor="#FFFFFF"> <td class="cell1">EXCEL文档</td> <td class="cell2"> <div class="line"> <span> <input name="" readonly="readonly" type="text" id="viewfile" name="viewfile" onmouseout="document.getElementById('photo').style.display='none';" /> </span> <input type="button" onmouseover="document.getElementById('photo').style.display='block';" name="button1" value="浏览" class="file1" /> <input type="file" value="<%=photo%>" name="photo" onchange="document.getElementById('viewfile').value=this.value;this.style.display='none';doCheckFile();" class="file" id="photo" /> </div> </td> </tr> </table> <br> <table width="90%" align="center"> <tr align="center"> <td><input type="button" name="button1" value=" 提交 " class="box_button" onclick="check('importExcel');"/> </td> </tr> </table> </form> </td> </tr> </table> <%@include file="/foot.jsp"%> </body> </html>