HTML5¼¼Êõ

ʵÏÖexcelµ¼Èëµ¼³ö¹¦ÄÜ£¬excelµ¼ÈëÊý¾Ýµ½Ò³ÃæÖУ¬Ò³ÃæÊý¾Ýµ¼³öÉú³ÉexcelÎļþ - »¹ÊÇÅÎÅκÃ(2)

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-07-02 13:00 ÎÒÒªÆÀÂÛ( )

$(function () {$("#confirm").on("click",function(){var files = $("input").eq(0).val();if(files==""){alert("ÇëÏÈÉÏ´«Îļþ");}});$("#cancel").on("click",function(){//webform.close();});$("#fileUpload").

$(function () { $("#confirm").on("click",function(){ var files = $("input").eq(0).val(); if(files==""){ alert("ÇëÏÈÉÏ´«Îļþ"); } }); $("#cancel").on("click",function(){ // webform.close(); }); $("#fileUpload").change(function(){ var val = $(this).val(); var fileName = val.split("\\")[val.split("\\").length-1]; if (val.indexOf("xls") != -1 || val.indexOf("xlsx") != -1) { $("input").eq(0).val(fileName); $('#formFile').ajaxSubmit({ url:'excel_targetFile.action', type:'POST', // data:{scmd:''}, ÐèÒª´«Ê²Ã´²ÎÊý×Ô¼ºÅäÖà success:function(data){ $("#confirm").on("click",function(){ alert("µ¼Èë³É¹¦"); }); $("#cancel").on("click",function(){ alert("È¡Ïûµ¼Èë"); }); }, error:function(xhr){ alert("ÉÏ´«³ö´í"); } }); } else { alert("ÇëÑ¡ÔñÕýÈ·µÄÎļþ¸ñʽ£¡"); //Çå¿ÕÉÏ´«Â·¾¶ $(this).val(""); return false; } }); })

¡¡¡¡ÕâÊÇjspÒ³Ãæ´úÂ룺

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script src="./js/jquery-1.9.1.min.js" type="text/javascript"></script> <script src="./js/jquery.form.js" type="text/javascript"></script> <script src="./js/excelJs.js" type="text/javascript"></script> <style type="text/css"> .file { position: relative; display: inline-block; background: #D0EEFF; border: 1px solid #99D3F5; border-radius: 4px; /* padding: 4px 12px; */ overflow: hidden; color: #1E88C7; text-decoration: none; text-indent: 0; line-height: 20px; top:6px; } .file input { position: absolute; font-size: 100px; right: 0; top: 0; opacity: 0; } .file:hover { background: #AADFFD; border-color: #78C3F3; color: #004974; text-decoration: none; } .positionFile{ margin-left: 10px; margin-top: 30px; } .poConfirm{ margin-top: 40px; margin-left: 65px; } </style> </head> <body > <form> <input type="text" value="" readonly="readonly"> <a href="javascript:;">µã»÷ÉÏ´«Îļþ <input type="file" > </a> <br> <input type="button" value="È·¶¨"> <input type="button" value="È¡Ïû"> </form> </body> </html>

¡¡¡¡

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • svgʵÏÖ¼òµ¥É³Â©Ðýת - ʦÃöù

    svgʵÏÖ¼òµ¥É³Â©Ðýת - ʦÃöù

    2017-07-01 08:00

  • svgʵÏÖ·Å´óЧ¹û - ʦÃöù

    svgʵÏÖ·Å´óЧ¹û - ʦÃöù

    2017-06-30 18:00

  • ÀûÓõ¥Æ¬»ú¿ìËÙʵÏÖ¼ÒÍ¥ÖÇÄÜ¿ØÖÆƽ̨ - СÎåÒå

    ÀûÓõ¥Æ¬»ú¿ìËÙʵÏÖ¼ÒÍ¥ÖÇÄÜ¿ØÖÆƽ̨ - СÎåÒå

    2017-06-29 18:00

  • css3ʵÏÖ¿ÉÒÔ¼ÆËãµÄ×ÔÊÊÓ¦²¼¾Ö¡ª¡ªcalc() - WEB´ó°×

    css3ʵÏÖ¿ÉÒÔ¼ÆËãµÄ×ÔÊÊÓ¦²¼¾Ö¡ª¡ªcalc() - WEB´ó°×

    2017-06-29 11:01

ÍøÓѵãÆÀ
Ä