{"id":4754,"date":"2016-01-20T18:08:45","date_gmt":"2016-01-20T10:08:45","guid":{"rendered":"https:\/\/sdeno.com\/?p=4754"},"modified":"2016-02-24T10:33:54","modified_gmt":"2016-02-24T02:33:54","slug":"%e5%9f%ba%e4%ba%8ehtml5%e7%9a%84%e5%8f%af%e9%a2%84%e8%a7%88%e5%a4%9a%e5%9b%be%e7%89%87ajax%e4%b8%8a%e4%bc%a0","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=4754","title":{"rendered":"\u57fa\u4e8eHTML5\u7684\u53ef\u9884\u89c8\u591a\u56fe\u7247Ajax\u4e0a\u4f20"},"content":{"rendered":"<p><a href=\"https:\/\/sdeno.com\/?p=4749\" target=\"_blank\">\u591a\u56fe\u7247\u4e0a\u4f20\u6848\u4f8b\u548c\u4e0b\u8f7d<\/a><\/p>\n<h3>\u4e00\u3001\u5173\u4e8e\u56fe\u7247\u4e0a\u4f20\u4ec0\u4e48\u4ec0\u4e48\u7684<\/h3>\n<p>\u5728XHTML\u7684\u65f6\u4ee3\uff0c\u6211\u4eec\u4f7f\u7528HTML file\u63a7\u4ef6\u4e0a\u4f20\u56fe\u7247\u4e00\u6b21\u53ea\u80fd\u4e0a\u4f20\u4e00\u5f20\u3002\u8981\u4e00\u6b21\u4e0a\u4f20\u591a\u56fe\uff0c\u505a\u6cd5\u662f\u501f\u52a9\u4e8eflash\u3002\u4f8b\u5982<a style=\"color: #34538b;\" href=\"http:\/\/www.swfupload.org\/\" target=\"_blank\">swfupload.js<\/a>\u3002\u53ef\u60dc\uff0c\u4f7f\u7528\u590d\u6742\u7684\u70b9\uff0c\u6bd4\u5982flash\u6587\u4ef6\u9700\u4e0e\u9875\u9762\u540c\u7236\u6587\u4ef6\u5939\uff0cJavaScript\u6587\u4ef6\u5927\u5c0f\u4e5f\u5f88\u53ef\u89c2\u3002<\/p>\n<p>\u6211\u4e4b\u524d\u66fe\u7ffb\u8bd1\u7f16\u8f91\u8fc7\u4e00\u7bc7\u201c<a style=\"color: #34538b;\" href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=342\">Ajax Upload\u591a\u6587\u4ef6\u4e0a\u4f20\u63d2\u4ef6<\/a>\u201d\u7684\u6587\u7ae0\uff0c\u6b64\u63d2\u4ef6\u7684\u4eae\u70b9\u662f\u4f7f\u7528\u9690\u85cf\u7684iframe\u6846\u67b6\u9875\u9762\u6a21\u62dfajax\u4e0a\u4f20\uff0c\u4f46\u662f\uff0c\u5b9e\u9645\u4e0a\uff0c\u8fd8\u662f\u4e00\u6b21\u53ea\u80fd\u4e0a\u4f201\u5f20\u56fe\u7247\uff0c\u53ef\u4ee5\u591a\u6b21\u4e0a\u4f20\u800c\u5df2\u3002<\/p>\n<p>HTML5\u662f\u4e2a\u597d\u4e1c\u4e1c\uff0c\u5176\u4e2d\u4e4b\u4e00\u5c31\u662f\u652f\u6301\u591a\u56fe\u7247\u4e0a\u4f20\uff0c\u800c\u4e14\u652f\u6301ajax\u4e0a\u4f20\uff0c\u800c\u4e14\u652f\u6301\u4e0a\u4f20\u4e4b\u524d\u56fe\u7247\u7684\u9884\u89c8\uff0c\u800c\u4e14\u652f\u6301\u56fe\u7247\u62d6\u62fd\u4e0a\u4f20\uff0c\u7eaf\u7cb9\u5229\u7528file\u63a7\u4ef6\u5b9e\u73b0\uff0cJS\u4ee3\u7801\u5be5\u5be5\uff0c\u60f3\u4e0d\u8ba9\u4eba\u79f0\u8d5e\u90fd\u96be\u554a\uff01<\/p>\n<h3>\u4e8c\u3001demo\u9875\u9762<\/h3>\n<p>\u5982\u679c\u60a8\u624b\u5934\u4e0a\u7684\u6d4f\u89c8\u5668\u662f\u6700\u65b0\u7684FireFox\u6216\u662fChrome\u6d4f\u89c8\u5668\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" style=\"color: #ff3300;\" href=\"http:\/\/www.zhangxinxu.com\/study\/201109\/html5-file-image-ajax-upload.html\" target=\"_blank\">\u57fa\u4e8eHTML5\u7684\u591a\u56feAjax\u4e0a\u4f20demo<\/a><\/p>\n<p>\u5728demo\u9875\u9762\u4e2d\uff0c\u60a8\u53ef\u4ee5\u70b9\u51fbfile\u63a7\u4ef6\u4e0a\u4f20\u591a\u56fe\uff0c\u5982\u4e0b\uff08FireFox 6\u622a\u56fe\u793a\u610f\uff0c\u4e0b\u540c\uff09\uff1a<br \/>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:454px\"><div style=\"padding-top:68.281938325991%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"454\" height=\"310\" class=\"alignnone lazyload\" title=\"\u9009\u62e9\u591a\u56fe \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201109\/2011-09-15_134248.png\" alt=\"\u9009\u62e9\u591a\u56fe \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\"><\/figure><\/p>\n<p>\u5982\u679c\u6709\u975e\u56fe\u7247\u6587\u4ef6\u6216\u662f\u56fe\u7247\u5c3a\u5bf8\u8fc7\u5927\uff0c\u4f1a\u5f39\u51fa\u63d0\u793a\uff1a<br \/>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:319px\"><div style=\"padding-top:68.33855799373%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"319\" height=\"218\" class=\"alignnone lazyload\" title=\"\u4e0d\u7b26\u5408\u8981\u6c42\u6587\u4ef6\u63d0\u793a \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201109\/2011-09-15_134729.png\" alt=\"\u4e0d\u7b26\u5408\u8981\u6c42\u6587\u4ef6\u63d0\u793a \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\"><\/figure><\/p>\n<p>\u6216\u8005\u60a8\u53ef\u4ee5\u76f4\u63a5\u5c06\u684c\u9762\u4e0a\u7684\u56fe\u7247\u62d6\u5230\u63a5\u53d7\u62d6\u62fd\u7684\u533a\u57df\u5904\uff1a<br \/>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:515px\"><div style=\"padding-top:37.281553398058%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"515\" height=\"192\" class=\"alignnone lazyload\" title=\"\u56fe\u7247\u62d6\u62fd\u793a\u610f \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201109\/2011-09-15_135032.png\" alt=\"\u56fe\u7247\u62d6\u62fd\u793a\u610f \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\"><\/figure><\/p>\n<p>\u91ca\u653e\u540e\u56fe\u7247\u5c31\u53ef\u4ee5\u76f4\u63a5\u9884\u89c8\u4e86\uff08\u6b64\u65f6\u8fd8\u672a\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e0a\uff09\uff1a<br \/>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:514px\"><div style=\"padding-top:63.424124513619%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"514\" height=\"326\" class=\"alignnone lazyload\" title=\"\u56fe\u7247\u4e0a\u4f20\u524d\u9884\u89c8 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201109\/2011-09-15_160659.png\" alt=\"\u56fe\u7247\u4e0a\u4f20\u524d\u9884\u89c8 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\"><\/figure><\/p>\n<p>\u6b64\u65f6\u56fe\u7247\u53ef\u63d0\u524d\u5220\u9664\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4e0a\u4f20\uff0c\u4f8b\u5982\uff0c\u6211\u4eec\u70b9\u51fb\u4e0a\u4f20\u6309\u94ae\uff0c\u5f88\u5feb\u7684\uff0c\u56fe\u7247\u4e0a\u4f20\u6210\u529f\u5566:)\uff01<\/p>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:430px\"><div style=\"padding-top:87.674418604651%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"430\" height=\"377\" class=\"alignnone lazyload\" title=\"\u56fe\u7247\u4e0a\u4f20\u4e2d\u8fdb\u5ea6\u663e\u793a\u793a\u610f \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201109\/2011-09-15_165805.jpg\" alt=\"\u56fe\u7247\u4e0a\u4f20\u4e2d\u8fdb\u5ea6\u663e\u793a\u793a\u610f \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\"><\/figure>\n<p>\u4e0a\u4f20\u540e\u7684\u9875\u9762\u5730\u5740\u5c31\u8fd4\u56de\u4e86\uff0c\u5982\u4e0b\uff1a<br \/>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:529px\"><div style=\"padding-top:18.714555765595%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"529\" height=\"99\" class=\"alignnone lazyload\" title=\"\u56fe\u7247\u4e0a\u4f20\u6210\u529f\u540e\u8fd4\u56de\u7684\u5730\u5740 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201109\/2011-09-15_170136.png\" alt=\"\u56fe\u7247\u4e0a\u4f20\u6210\u529f\u540e\u8fd4\u56de\u7684\u5730\u5740 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\"><\/figure><\/p>\n<p>\u6b64\u65f6\uff0c\u5bf9\u5e94\u7684upload\u6587\u4ef6\u5939\u4e0b\u9762\u8fd9\u5f20\u56fe\u7247\u5c31\u6709\u4e86\uff1a<br \/>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:360px\"><div style=\"padding-top:28.055555555556%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"360\" height=\"101\" class=\"alignnone lazyload\" title=\"\u6587\u4ef6\u5939\u4e0b\u9762\u4e0a\u4f20\u7684\u5bf9\u5e94\u56fe\u7247\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201109\/2011-09-15_170327.png\" alt=\"\u6587\u4ef6\u5939\u4e0b\u9762\u4e0a\u4f20\u7684\u5bf9\u5e94\u56fe\u7247\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\"><\/figure><\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong>\u9119\u4eba\u535a\u5ba2\u7a7a\u95f4\u5927\u5c0f\u6709\u9650\uff0c\u6211\u4f1a\u5b9a\u65f6\u6e05\u7406\u8be5\u56fe\u7247\u6587\u4ef6\u5939\uff0cso, \u8bf8\u4f4d\u4e0d\u8981\u628a\u8fd9\u91cc\u5f53\u505a\u514d\u8d39\u7684\u56fe\u7247\u6258\u7ba1\u573a\u6240\u54e6~~<\/p>\n<h3>\u4e09\u3001\u6838\u5fc3\u9aa8\u67b6\u811a\u672c\u7b80\u5355\u5256\u6790<\/h3>\n<p>\u9996\u5148\u662f\u6587\u4ef6\u4e0a\u4f20\u7684\u4e00\u4e2acore\u6587\u4ef6\uff0c\u662f\u524d\u4e24\u4e2a\u665a\u4e0a\u6162\u6162\u541e\u541e\u6574\u51fa\u6765\u7684\u3002\u6587\u4ef6\u540d\u662f\uff1a\u00a0<a class=\"a_link\" style=\"color: #ff3300;\" href=\"http:\/\/www.zhangxinxu.com\/study\/js\/zxxFile.js\" target=\"_blank\">zxxFile.js<\/a>\u00a0(\u53ef\u53f3\u952e\u2026\u2026\u4e0b\u8f7d)<\/p>\n<p>\u6b64\u6587\u4ef6\u5c31\u51e0K\uff0c\u767e\u6765\u884c\u4ee3\u7801\uff0c\u4e3b\u8981\u8d1f\u8d23\u6587\u4ef6\u4e0a\u4f20\u76f8\u5173\u7684\u903b\u8f91\uff08\u9009\u62e9\u3001\u5220\u9664\u4e4b\u7c7b\uff09\uff0c\u539f\u751fJS\uff0c\u56e0\u6b64\uff0c\u517c\u5bb9jQuery,YUI, MooYools\u7b49\u3002<code>zxxFile.js<\/code>\u5176\u5b9e\u662f\u4e2a\u5c0f\u5de7\u7684\u9aa8\u67b6\u6587\u4ef6\uff0c\u8089\u4f53\u7b49\u5219\u9700\u8981\u53e6\u5916\u6dfb\u52a0\u3002<\/p>\n<p>zxxFile.js\u5176\u5b9e\u5c31\u662f\u4e2a\u5c0f\u5c0f\u5bf9\u8c61\u800c\u5df2\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">var ZXXFILE = {\r\n    <span style=\"color: green;\">\/\/\u9aa8\u67b6\u4eec...<\/span>\r\n}\r\n<\/pre>\n<\/div>\n<p>\u4e0b\u8868\u663e\u793a\u4e3aZXXFILE\u5bf9\u8c61\u7684\u5c5e\u6027\uff08\u9aa8\u67b6\uff09\u53ca\u5176\u5bf9\u5e94\u7684\u5185\u5bb9\u542b\u4e49\u7b49\u3002<\/p>\n<table class=\"params_table\" border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\">\n<tbody>\n<tr>\n<th scope=\"col\">\u5c5e\u6027\u6216\u65b9\u6cd5<\/th>\n<th scope=\"col\">\u9ed8\u8ba4\u65b9\u6cd5\u6216\u503c<\/th>\n<th scope=\"col\">\u91ca\u4e49<\/th>\n<\/tr>\n<tr>\n<td>fileInput<\/td>\n<td>null<\/td>\n<td>DOM\u5143\u7d20\u3002\u8868file\u63a7\u4ef6\u5143\u7d20\u3002<\/td>\n<\/tr>\n<tr>\n<td>dragDrop<\/td>\n<td>null<\/td>\n<td>DOM\u5143\u7d20\u3002\u8868\u62d6\u653e\u611f\u5e94\u533a\u57df\u5143\u7d20\u3002<\/td>\n<\/tr>\n<tr>\n<td>upButton<\/td>\n<td>null<\/td>\n<td>DOM\u5143\u7d20\u3002\u63d0\u4ea4\u7684\u6309\u94ae\u5143\u7d20\u3002<\/td>\n<\/tr>\n<tr>\n<td>url<\/td>\n<td>&#8220;&#8221;<\/td>\n<td>\u5b57\u7b26\u4e32\u3002\u8868\u793a\u6587\u4ef6ajax\u4e0a\u4f20\u7684\u5730\u5740<\/td>\n<\/tr>\n<tr>\n<td>fileFilter<\/td>\n<td>[]<\/td>\n<td>\u8fc7\u6ee4\u540e\u7684\u6587\u4ef6\u5bf9\u8c61\u6570\u7ec4\uff0c\u4e00\u822c\u4e0d\u53c2\u4e0e\u521d\u59cb\u5316\u3002\u53ef\u7528\u6765\u5224\u65ad\u5f53\u524d\u5217\u8868\u7684\u6570\u76ee\u3002<\/td>\n<\/tr>\n<tr>\n<td>filter<\/td>\n<td>function(files) {<br \/>\nreturn files;<br \/>\n}<\/td>\n<td>\u51fd\u6570\u3002\u7528\u6765\u8fc7\u6ee4\u9009\u62e9\u7684\u6587\u4ef6\u5217\u8868\u3002\u4f8b\u5982\u53ea\u80fd\u662f\u9009\u62e9\u56fe\u7247\uff0c\u6216\u662f\u5927\u5c0f\u5c3a\u5bf8\u9650\u5236\u7b49\u3002\u652f\u6301\u4e00\u4e2a\u53c2\u6570(files)\uff0c\u4e3a\u6587\u4ef6\u5bf9\u8c61\u6570\u7ec4\uff0c\u9700\u8fd4\u56de\u6570\u7ec4\u3002<\/td>\n<\/tr>\n<tr>\n<td>onSelect<\/td>\n<td>function() {}<\/td>\n<td>\u51fd\u6570\u3002\u5f53\u672c\u5730\u6587\u4ef6\u88ab\u9009\u62e9\u4e4b\u540e\u6267\u884c\u7684\u56de\u8c03\u3002\u652f\u6301\u4e00\u4e2a\u53c2\u6570(files)\uff0c\u4e3a\u6587\u4ef6\u5bf9\u8c61\u6570\u7ec4\u3002<\/td>\n<\/tr>\n<tr>\n<td>onDelete<\/td>\n<td>function() {}<\/td>\n<td>\u51fd\u6570\u3002\u5f53\u67d0\u4e00\u4e2a\u4e0a\u4f20\u6587\u4ef6\u4e0a\u4f20\u6210\u529f\u4e4b\u540e\uff08\u81ea\u52a8\uff09\u6216\u88ab\u5220\u9664\uff08\u624b\u52a8\uff09\u7684\u65f6\u5019\u6267\u884c\u7684\u65b9\u6cd5\u3002\u63a5\u53d7\u4e00\u4e2a\u53c2\u6570(file)\uff0c\u8868\u5f53\u524d\u5220\u9664\u6587\u4ef6\u3002<\/td>\n<\/tr>\n<tr>\n<td>onDragOver<\/td>\n<td>function() {}<\/td>\n<td>\u51fd\u6570\u3002\u5f53\u672c\u5730\u6587\u4ef6\u88ab\u62d6\u5230\u62d6\u62fd\u654f\u611f\u5143\u7d20\u4e0a\u9762\u65f6\u6267\u884c\u7684\u65b9\u6cd5\u3002\u65b9\u6cd5\u4e2d\u7684this\u6307\u8be5\u654f\u611f\u5143\u7d20\uff0c\u4e5f\u5c31\u662f\u4e0a\u9762\u7684dragDrop\u5143\u7d20\u3002<\/td>\n<\/tr>\n<tr>\n<td>onDragLeave<\/td>\n<td>function() {}<\/td>\n<td>\u51fd\u6570\u3002\u5f53\u672c\u5730\u6587\u4ef6\u79bb\u5f00\u62d6\u62fd\u654f\u611f\u5143\u7d20\u65f6\u6267\u884c\u7684\u65b9\u6cd5\u3002\u65b9\u6cd5\u4e2d\u7684this\u6307\u8be5\u654f\u611f\u5143\u7d20\uff0c\u4e5f\u5c31\u662f\u4e0a\u9762\u7684dragDrop\u5143\u7d20\u3002<\/td>\n<\/tr>\n<tr>\n<td>onProgress<\/td>\n<td>function() {}<\/td>\n<td>\u51fd\u6570\u3002\u6587\u4ef6\u4e0a\u4f20\u8fc7\u7a0b\u4e2d\u6267\u884c\u7684\u56de\u8c03\u65b9\u6cd5\u3002\u63a5\u53d7\u4e09\u4e2a\u53c2\u6570(file, loaded, total)\uff0c\u5206\u522b\u8868\u793a\u5f53\u524d\u4e0a\u4f20\u6587\u4ef6\u5bf9\u8c61\uff0c\u5df2\u4e0a\u4f20\u5b57\u8282\u6570\uff0c\u6587\u4ef6\u603b\u5b57\u8282\u6570\u3002<\/td>\n<\/tr>\n<tr>\n<td>onSuccess<\/td>\n<td>function() {}<\/td>\n<td>\u51fd\u6570\u3002\u5f53\u524d\u6587\u4ef6\u4e0a\u4f20\u6210\u529f\u6267\u884c\u7684\u56de\u8c03\u65b9\u6cd5\u3002\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570(file, response)\uff0c\u8868\u793a\u5f53\u524d\u4e0a\u4f20\u6210\u529f\u7684\u6587\u4ef6\u5bf9\u8c61\u548c\u540e\u53f0\u8fd4\u56de\u7684\u5b57\u7b26\u5185\u5bb9\u3002<\/td>\n<\/tr>\n<tr>\n<td>onFailure<\/td>\n<td>function() {}<\/td>\n<td>\u51fd\u6570\u3002\u5f53\u524d\u6587\u4ef6\u4e0a\u4f20\u5931\u8d25\u6267\u884c\u7684\u56de\u8c03\u65b9\u6cd5\u3002\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570(file, response)\uff0c\u8868\u793a\u5f53\u524d\u4e0a\u4f20\u5931\u8d25\u7684\u6587\u4ef6\u5bf9\u8c61\u548c\u540e\u53f0\u8fd4\u56de\u7684\u5b57\u7b26\u5185\u5bb9\u3002<\/td>\n<\/tr>\n<tr>\n<td>onComplete<\/td>\n<td>function() {}<\/td>\n<td>\u51fd\u6570\u3002\u5f53\u524d\u6587\u4ef6\u5bf9\u8c61\u5217\u8868\u5168\u90e8\u4e0a\u4f20\u5b8c\u6bd5\u6267\u884c\u7684\u56de\u8c03\u65b9\u6cd5\u3002\u65e0\u53ef\u7528\u53c2\u6570\u3002<\/td>\n<\/tr>\n<tr>\n<td>funDragHover<\/td>\n<td>\u7565<\/td>\n<td>\u65b9\u6cd5\u3002\u6587\u4ef6\u62d6\u62fd\u76f8\u5173\u3002\u975e\u53ef\u7528API\u3002<\/td>\n<\/tr>\n<tr>\n<td>funGetFiles<\/td>\n<td>\u7565<\/td>\n<td>\u65b9\u6cd5\u3002\u83b7\u53d6\u9009\u62e9\u6216\u62d6\u62fd\u6587\u4ef6\u3002\u975e\u53ef\u7528API\u3002<\/td>\n<\/tr>\n<tr>\n<td>funDealFiles<\/td>\n<td>\u7565<\/td>\n<td>\u65b9\u6cd5\u3002\u5bf9\u9009\u62e9\u6587\u4ef6\u8fdb\u884c\u5904\u7406\u3002\u975e\u53ef\u7528API\u3002<\/td>\n<\/tr>\n<tr>\n<td>funDeleteFile<\/td>\n<td>\u7565<\/td>\n<td>\u65b9\u6cd5\u3002\u5220\u9664\u5217\u8868\u4e2d\u7684\u67d0\u4e2a\u6587\u4ef6\u3002\u5916\u90e8\u53ef\u7528API\uff0c\u5728\u624b\u52a8\u5220\u9664\u67d0\u6587\u4ef6\u65f6\u9700\u8c03\u7528\u6b64\u65b9\u6cd5\u3002<\/td>\n<\/tr>\n<tr>\n<td>funUploadFile<\/td>\n<td>\u7565<\/td>\n<td>\u65b9\u6cd5\u3002\u6587\u4ef6\u4e0a\u4f20\u76f8\u5173\u3002\u975e\u53ef\u7528API\u3002<\/td>\n<\/tr>\n<tr>\n<td>init<\/td>\n<td>\u7565<\/td>\n<td>\u65b9\u6cd5\u3002\u521d\u59cb\u5316\uff0c\u4e3b\u8981\u662f\u4e00\u4e2a\u5143\u7d20\u7684\u4e8b\u4ef6\u7ed1\u5b9a\u3002\u975e\u53ef\u7528API\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u8865\u5145\u8bf4\u660e\uff1a<\/strong>\u4e0a\u9762\u591a\u6b21\u63d0\u5230\u7684file\u53c2\u6570\u6307\u7684\u662f<code>file object<\/code>\u5bf9\u8c61\uff0c\u8be5\u5bf9\u8c61\u7684\u5c5e\u6027\u503c\u6709<code>name, size, type<\/code>\u7b49\uff0c\u7136\u540e\uff0c\u5728<code>zxxFile.js<\/code>\u4e2d\uff0c\u5176\u8fd8\u591a\u4e86\u4e2a\u65b9\u4fbf\u5143\u7d20\u5b9a\u4f4d\u7684<code>index<\/code>\u7d22\u5f15\u5c5e\u6027\u3002<\/p>\n<p>\u663e\u7136\uff0c\u53ea\u6709\u9aa8\u67b6\u57fa\u672c\u4e0a\u505a\u4e0d\u4e86\u4ec0\u4e48\u4e8b\u4ef6\u3002demo\u9875\u9762\u4e4b\u6240\u4ee5\u6709\u6548\u679c\uff0c\u5c31\u662f\u5176\u6309\u7167\u4e0a\u9762\u7684\u9aa8\u67b6\uff0c\u6839\u636e\u5b9e\u9645\u7684\u9700\u6c42\u589e\u52a0\u4e86\u8840\u8089\u3002\u60a8\u53ef\u4ee5\u76f4\u63a5\u201c\u53f3\u952e-\u67e5\u770b\u9875\u9762\u6e90\u4ee3\u7801\u201d\u4e00\u89c8\u6240\u6709\u76f8\u5173JavaScript\u3002\u6216\u8005\u770b\u6211\u4e0b\u9762\u4e00\u70b9\u4e00\u70b9\u5a46\u5988\u7684\u8bb2\u8ff0\u3002<\/p>\n<p>\u6211\u4eec\u6309\u7167\u4e0a\u9762\u8868\u683c\u4e2d\u7684\u9aa8\u67b6\u8fdb\u884c\u793a\u610f\u3002demo\u9875\u9762\u501f\u7528\u4e86\u6bd4\u8f83\u6d41\u884c\u7684jQuery\u5e93\uff0c<strong>\u9aa8\u67b6+\u8840\u8089 = \u63d2\u4ef6<\/strong>\uff0c\u5f53\u7136\uff0cdemo\u9875\u9762\u5e76\u4e0d\u662f\u5954\u7740\u63d2\u4ef6\u53bb\u7684\uff08\u867d\u7136\u53ea\u9700\u7a0d\u52a0\u4fee\u6539\uff09\uff0c\u56e0\u4e3a\u9875\u9762\u7684UI\u663e\u7136\u4e0d\u591f\u63d2\u4ef6\u7684\u4efd\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u5229\u7528<code>zxxFile.js<\/code>\u9aa8\u67b6\uff0c\u914d\u5408\u70b9\u4f60\u81ea\u5df1\u5c5e\u6027\u7684JavaScript\u5e93\u5c31\u53ef\u4ee5\u4e66\u5199\u5c5e\u4e8e\u4f60\u81ea\u5df1\u7684\u57fa\u4e8eHTML5\u7684\u591a\u6587\u4ef6Ajax\u4e0a\u4f20\u63d2\u4ef6\u5566\uff01<\/p>\n<h3>\u56db\u3001demo\u9875\u9762\u7684\u4e9b\u4ee3\u7801<\/h3>\n<p>demo\u9875\u9762\u4ee3\u7801\u6574\u4f53\u903b\u8f91\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">var params = {\r\n    <span style=\"color: green;\">\/\/\u8840\u8089\u4eec<\/span>\r\n};\r\nZXXFILE = $.extend(ZXXFILE, params);\r\nZXXFILE.init();<\/pre>\n<\/div>\n<p><strong>fileInput<\/strong><br \/>\n\u9996\u5148\u662ffile\u63a7\u4ef6\u5143\u7d20\uff0c\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">fileInput: $(\"#fileImage\").get(0)<\/pre>\n<\/div>\n<p>\u56e0\u4e3a\u662fDOM\u5143\u7d20\uff0c\u6240\u4ee5\u5e94\u7528\u4e86jQuery\u7684<code>get<\/code>\u65b9\u6cd5\u3002\u4e0b\u9762\u4e24\u4e2a\u53c2\u6570\u540c\u3002<\/p>\n<p>demo\u9875\u9762\u4e2d\u7684file\u63a7\u4ef6\u5143\u7d20\u652f\u6301\u591a\u6587\u4ef6\u9009\u62e9\uff0c\u5176\u9690\u85cf\u7684\u7384\u673a\u5c31\u662f\u4e0b\u9762\u4ee3\u7801\u4e2d\u5927\u7ea2\u9ad8\u4eae\u7684\u90e8\u5206\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">&lt;input id=\"fileImage\" type=\"file\" size=\"30\" name=\"fileselect[]\" <span style=\"color: #cd0000;\">multiple<\/span> \/&gt;<\/pre>\n<\/div>\n<p><strong>dragDrop\u548cupButton<\/strong><br \/>\n\u62d6\u62fd\u533a\u57df\u548c\u4e0a\u4f20\u6309\u94ae(\u9ed8\u8ba4\u9690\u85cf)\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">dragDrop: $(\"#fileDragArea\").get(0),\r\nupButton: $(\"#fileSubmit\").get(0)<\/pre>\n<\/div>\n<p><strong>url<\/strong><br \/>\nAjax\u4e0a\u4f20\u5730\u5740\uff0c\u6ca1\u4ec0\u4e48\u597d\u8bf4\u7684\uff0c\u53d6\u7684\u662f\u8868\u5355\u7684action\u5730\u5740\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">url: $(\"#uploadForm\").attr(\"action\")<\/pre>\n<\/div>\n<p><strong>filter\u65b9\u6cd5<\/strong><br \/>\n\u5bf9\u9009\u62e9\u7684\u6587\u4ef6\u8fdb\u884c\u8fc7\u6ee4\u3002file\u63a7\u4ef6\u4ec0\u4e48\u6587\u4ef6\u90fd\u80fd\u9009\uff0c\u800cdemo\u9875\u9762\u662f\u56fe\u7247\u4e0a\u4f20\u76f8\u5173\u7684demo\uff1b\u7a7a\u95f4\u5927\u5c0f\u6709\u9650\uff0c\u8d85\u5927\u5c3a\u5bf8\u7684\u56fe\u7247\u8fd8\u662f\u6321\u7740\u4e3a\u597d\u3002\u663e\u7136\uff0c\u8981\u5bf9\u4e0a\u4f20\u6587\u4ef6\u8fdb\u884c\u8fc7\u6ee4\u3002\u4e8e\u662f\uff0c\u5c31\u6709\u4e86\u5982\u4e0b\u7684\u8fc7\u6ee4\u811a\u672c\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">filter: function(files) {\r\n    var arrFiles = [];\r\n    for (var i = 0, file; file = files[i]; i++) {\r\n        if (file.type.indexOf(\"image\") == 0) {\r\n            if (file.size &gt;= 512000) {\r\n                alert('\u60a8\u8fd9\u5f20\"'+ file.name +'\"\u56fe\u7247\u5927\u5c0f\u8fc7\u5927\uff0c\u5e94\u5c0f\u4e8e500k');\t\r\n            } else {\r\n                arrFiles.push(file);\t\r\n            }\t\t\t\r\n        } else {\r\n            alert('\u6587\u4ef6\"' + file.name + '\"\u4e0d\u662f\u56fe\u7247\u3002');\t\r\n        }\r\n    }\r\n    return arrFiles;\r\n}<\/pre>\n<\/div>\n<p><code>zxxFile.js<\/code>\u4f1a\u81ea\u52a8\u5bf9\u8fc7\u6ee4\u540e\u7684\u6587\u4ef6\u5bf9\u8c61\u5217\u8868\u8fdb\u884c\u6574\u5408\uff0c\u4ee5\u51c6\u786e\u4e0a\u4f20\u3002<\/p>\n<p><strong>onSelect\u65b9\u6cd5<\/strong><br \/>\n\u6587\u4ef6\uff08\u8fd9\u91cc\u5c31\u662f\u56fe\u7247\uff09\u9009\u62e9\u540e\u6267\u884c\u7684\u65b9\u6cd5\u3002\u5728\u672c\u5b9e\u4f8b\u9875\u9762\u4e2d\uff0c<code>onSelect<\/code>\u65b9\u6cd5\u7684\u4e3b\u8981\u4efb\u52a1\u5c31\u662f\u672c\u5730\u56fe\u7247\u5728\u6d4f\u89c8\u5668\u4e2d\u7684\u9884\u89c8\u3002\u672c\u5730\u56fe\u7247\u4e0a\u4f20\u4e4b\u524d\u5728\u6d4f\u89c8\u5668\u4e2d\u9884\u89c8\u7684\u6838\u5fc3\u811a\u672c\u5c31\u662f\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">var reader = new FileReader(), htmlImage;\r\nreader.onload = function(e) {\r\n    htmlImage = '&lt;img src=\"'+ e.target.result +'\" \/&gt;';\r\n}\r\nreader.readAsDataURL(file);<\/pre>\n<\/div>\n<p>\u5728\u672cdemo\u9875\u9762\u4e2d\uff0c\u8be5\u90e8\u5206\u5b8c\u6210\u811a\u672c\u5982\u4e0b\uff0c\u867d\u597d\u50cf\u6709\u4e9b\u957f\u5ea6\uff0c\u5176\u5b9e\u5185\u5bb9\u5c31\u662f\u88c5\u8f7d\u4e00\u4e9bHTML\u4ee3\u7801\u800c\u5df2\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">onSelect: function(files) {\r\n    var html = '', i = 0;\r\n    <span style=\"color: green;\">\/\/\u7b49\u5f85\u8f7d\u5165gif\u52a8\u753b<\/span>\r\n    $(\"#preview\").html('&lt;div class=\"upload_loading\"&gt;&lt;\/div&gt;');\r\n    var funAppendImage = function() {\r\n        file = files[i];\r\n        if (file) {\r\n            var reader = new FileReader()\r\n            reader.onload = function(e) {\r\n                html = html + '&lt;div id=\"uploadList_'+ i +'\" class=\"upload_append_list\"&gt;&lt;p&gt;&lt;strong&gt;' + file.name + '&lt;\/strong&gt;'+ \r\n                    '&lt;a href=\"javascript:\" class=\"upload_delete\" title=\"\u5220\u9664\" data-index=\"'+ i +'\"&gt;\u5220\u9664&lt;\/a&gt;&lt;br \/&gt;' +\r\n                    '&lt;img id=\"uploadImage_' + i + '\" src=\"' + e.target.result + '\" class=\"upload_image\" \/&gt;&lt;\/p&gt;'+ \r\n                    '&lt;span id=\"uploadProgress_' + i + '\" class=\"upload_progress\"&gt;&lt;\/span&gt;' +\r\n                '&lt;\/div&gt;';\r\n                \r\n                i++;\r\n                funAppendImage();\r\n            }\r\n            reader.readAsDataURL(file);\r\n        } else {\r\n            <span style=\"color: green;\">\/\/\u56fe\u7247\u76f8\u5173HTML\u7247\u6bb5\u8f7d\u5165<\/span>\r\n            $(\"#preview\").html(html);\r\n            if (html) {\r\n                <span style=\"color: green;\">\/\/\u5220\u9664\u65b9\u6cd5<\/span>\r\n                $(\".upload_delete\").click(function() {\r\n                    <span style=\"color: black;\">ZXXFILE.funDeleteFile(files[parseInt($(this).attr(\"data-index\"))]);<\/span>\r\n                    return false;\t\r\n                });\r\n                <span style=\"color: green;\">\/\/\u63d0\u4ea4\u6309\u94ae\u663e\u793a<\/span>\r\n                $(\"#fileSubmit\").show();\t\r\n            } else {\r\n                <span style=\"color: green;\">\/\/\u63d0\u4ea4\u6309\u94ae\u9690\u85cf<\/span>\r\n                $(\"#fileSubmit\").hide();\t\r\n            }\r\n        }\r\n    };\r\n    <span style=\"color: green;\">\/\/\u6267\u884c\u56fe\u7247HTML\u7247\u6bb5\u7684\u8f7d\u4eba<\/span>\r\n    funAppendImage();\t\t\r\n}<\/pre>\n<\/div>\n<p>\u7ec6\u5fc3\u7684\u4f60\u53ef\u80fd\u53d1\u73b0\u5230\u4e0a\u9762\u7684HTML\u5143\u7d20\u4e2d\u57fa\u672c\u4e0a\u90fd\u7528\u5230\u4e86<code>i<\/code>\u8fd9\u4e2a\u7d22\u5f15\uff0c\u4f5c\u7528\u662f\u65b9\u4fbf\u540e\u9762\u5220\u9664\u53ef\u4ee5\u627e\u5230\u76f8\u5e94\u7684\u5143\u7d20\u3002<br \/>\n\u7136\u540e\uff0c\u8fd8\u6709\u4e00\u4e2a\u9700\u8981\u6ce8\u610f\u7684\u5c31\u662f\u5220\u9664\u4e8b\u4ef6\u2014\u2014\u6267\u884c\u4e86<code>ZXXFILE.funDeleteFile()<\/code>\u65b9\u6cd5\uff0c\u8fd9\u662f\u5fc5\u987b\u7684\uff0c\u771f\u6b63\u5c06\u56fe\u7247\u4ece\u6587\u4ef6\u5217\u8868\u4e2d\u5220\u9664\uff0c\u540c\u65f6\u7528\u6765\u89e6\u53d1<code>onDelete<\/code>\u65b9\u6cd5\u7684\u56de\u8c03\u3002<\/p>\n<p><strong>onDelete\u65b9\u6cd5<\/strong><br \/>\n\u56fe\u7247\u4e0a\u4f20\u5b8c\u6bd5\u6216\u662f\u5220\u9664\u4e4b\u65f6\u6267\u884c\u98de\u65b9\u6cd5\u3002\u672c\u5b9e\u4f8b\u662f\u8ba9\u5176\u6e10\u9690\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">onDelete: function(file) {\r\n    $(\"#uploadList_\" + file.index).fadeOut();\r\n}<\/pre>\n<\/div>\n<p><strong>onDragOver\u65b9\u6cd5<\/strong><br \/>\n\u6587\u4ef6\u62d6\u5230\u62d6\u62fd\u5143\u7d20\u4e0a\u65f6\u6267\u884c\u7684\u65b9\u6cd5\uff0c\u672c\u5b9e\u4f8b\u5c31\u662f\u589e\u52a0\u4e86\u4e2a\u7c7b\u540d\uff0c\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">onDragOver: function() {\r\n    $(this).addClass(\"upload_drag_hover\");\r\n}<\/pre>\n<\/div>\n<p><strong>onDragLeave\u65b9\u6cd5<\/strong><br \/>\n\u6587\u4ef6\u79fb\u51fa\u5143\u7d20\u4e0a\u65f6\u6267\u884c\u7684\u65b9\u6cd5\uff0c\u672c\u5b9e\u4f8b\u5c31\u662f\u53bb\u6389\u4e86\u4e2a\u7c7b\u540d\uff0c\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">onDragLeave: function() {\r\n    $(this).addClass(\"upload_drag_hover\");\r\n}<\/pre>\n<\/div>\n<p><strong>onProgress\u65b9\u6cd5<\/strong><br \/>\n\u4e0a\u4f20\u4e2d\u89e6\u53d1\u7684\u65b9\u6cd5\u3002\u672cdemo\u6548\u679c\u5c31\u662f\u56fe\u7247\u5de6\u4e0a\u89d2\u6709\u4e2a\u6709\u7740\u5706\u89d2\u9ed1\u8272\u534a\u900f\u660e\u80cc\u666f\u5143\u7d20\uff0c\u91cc\u9762\u7684\u767e\u5206\u6bd4\u503c\u4e0d\u65ad\u589e\u52a0\u3002\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">onProgress: function(file, loaded, total) {\r\n    var eleProgress = $(\"#uploadProgress_\" + file.index), percent = (loaded \/ total * 100).toFixed(2) + '%';\r\n    eleProgress.show().html(percent);\r\n}<\/pre>\n<\/div>\n<p><strong>onSuccess\u65b9\u6cd5<\/strong><br \/>\n\u5f53\u524d\u56fe\u7247\u4e0a\u4f20\u6210\u529f\u540e\u6267\u884c\u7684\u65b9\u6cd5\u3002\u672cdemo\u5c31\u662f\u63d0\u793a\u8fd4\u56de\u7684\u56fe\u7247\u5730\u5740\u4fe1\u606f\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">onSuccess: function(file, response) {\r\n    $(\"#uploadInf\").append(\"\"&lt;p&gt;\u4e0a\u4f20\u6210\u529f\uff0c\u56fe\u7247\u5730\u5740\u662f\uff1a\" + response + \"\"&lt;\/p&gt;\");\r\n}<\/pre>\n<\/div>\n<p><strong>onFailure\u65b9\u6cd5<\/strong><br \/>\n\u56fe\u7247\u4e0a\u4f20\u55dd\u5c41\u65f6\u5c3f\u51fa\u7684\u65b9\u6cd5\u3002\u672cdemo\u4e3a\u63d0\u793a\uff0c\u7136\u540e\u56fe\u7247\u6d45\u900f\u660e\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">onFailure: function(file) {\r\n    $(\"#uploadInf\").append(\"&lt;p&gt;\u56fe\u7247\" + file.name + \"\u4e0a\u4f20\u5931\u8d25\uff01&lt;\/p&gt;\");\t\r\n    $(\"#uploadImage_\" + file.index).css(\"opacity\", 0.2);\r\n}<\/pre>\n<\/div>\n<p><strong>onComplete\u65b9\u6cd5<\/strong><br \/>\n\u5f53\u6240\u6709\u56fe\u7247\u90fd\u4e0a\u4f20\u5b8c\u6bd5\u4e4b\u540e\uff0c\u672c\u5b9e\u4f8b\u9875\u9762\u628afile\u63a7\u4ef6\u7684<code>value<\/code>\u503c\u7f6e\u7a7a\uff0c\u540c\u65f6\u6309\u94ae\u9690\u85cf\u4e86\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">onComplete: function() {\r\n    <span style=\"color: green;\">\/\/\u63d0\u4ea4\u6309\u94ae\u9690\u85cf<\/span>\r\n    $(\"#fileSubmit\").hide();\r\n    <span style=\"color: green;\">\/\/file\u63a7\u4ef6value\u7f6e\u7a7a<\/span>\r\n    $(\"#fileImage\").val(\"\");\r\n    $(\"#uploadInf\").append(\"&lt;p&gt;\u5f53\u524d\u56fe\u7247\u5168\u90e8\u4e0a\u4f20\u5b8c\u6bd5\uff0c\u53ef\u7ee7\u7eed\u6dfb\u52a0\u4e0a\u4f20\u3002&lt;\/p&gt;\");\r\n}<\/pre>\n<\/div>\n<p><strong>PHP\u9875\u9762\u76f8\u5173\u4ee3\u7801<\/strong><\/p>\n<div class=\"zxx_code\">\n<pre style=\"color: #0000ff;\">$fn = (isset($_SERVER['HTTP_X_FILENAME']) ? $_SERVER['HTTP_X_FILENAME'] : false);\r\nif ($fn) {\r\n    file_put_contents(\r\n        'uploads\/' . $fn,\r\n        file_get_contents('php:\/\/input')\r\n    );\r\n    echo \"http:\/\/www.zhangxinxu.com\/study\/201109\/uploads\/$fn\";\r\n    exit();\r\n}<\/pre>\n<\/div>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e3b\u8981\u7684\u4e9b\u529f\u80fd\u6216\u4ea4\u4e92\u4ee3\u7801\u3002\u81f3\u4e8eCSS\u6837\u5f0f\u90e8\u5206\u4ee5\u53caHTML\u4ee3\u7801\u4e2d\u7684\u4e00\u4e9b\u7ec6\u8282\u6211\u5c31\u61d2\u5f97\u6361\u829d\u9ebb\u4e86\u3002\u60a8\u6709\u5174\u8da3\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6e90\u4ee3\u7801\u89c2\u6469\u89c2\u6469\u3002<\/p>\n<h3>\u4e94\u3001\u5f53\u4e0bHTML5\u6587\u4ef6Ajax\u4e0a\u4f20\u5e94\u7528\u8303\u56f4<\/h3>\n<p>\u4e0d\u4ec5IE\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\uff0c\u6700\u65b0win\u4e0b\u7684Safari\u6d4f\u89c8\u5668\uff0c\u6216\u662fOpera\u90fd\u4e0d\u5b8c\u5168\u5b8c\u5168\u652f\u6301HTML5\u7684\u53ef\u9884\u89c8\u591a\u56fe\u7247Ajax\u4e0a\u4f20\uff0c\u90a3\u6211\u4eec\u8fd8\u6709\u5b66\u4e60\u8fd9\u4e2a\u5e72\u561b\u5462\uff1f\u81f3\u5c11\u73b0\u5728\u9e1f\u8fd9\u4e2a\u662f\u6ca1\u6709\u7684\u3002<\/p>\n<p>\u786e\u5b9e\uff0c\u6211\u4eec\u5bf9\u5916\u7684\u4e00\u4e9b\u9879\u76ee\uff0c\u7ed9\u5e7f\u5927\u7528\u6237\u4f7f\u7528\u7684web\u9875\u9762\u4f7f\u7528\u8fd9\u9879\u6280\u672f\u4e3a\u65f6\u8fc7\u65e9\u3002\u4f46\u662f\uff0c\u5bf9\u4e8e\u516c\u53f8\u7684\u5185\u7f51\u9879\u76ee\uff0c\u5e94\u7528\u8fd9\u4e2a\u7edd\u5bf9OK\u7684\u3002\u6211\u53d1\u73b0\u4e86\u4e2a\u5f88\u5947\u602a\u7684\u95ee\u9898\uff0c\u5f88\u591a\u65f6\u5019\uff0c\u5185\u7f51\u7684\u7f51\u9875\u90fd\u662f\u652f\u6301\u4f4e\u7248\u672c\u7684IE\u8f83\u597d\uff0c\u5bf9\u4e8e\u73b0\u4ee3\u6d4f\u89c8\u5668\u5374\u4e0d\u652f\u6301\u3002\u8fd9\u5b8c\u5168\u662f\u8d70\u5728\u9519\u8bef\u7684\u9053\u8def\u4e0a\u3002<\/p>\n<p>\u6700\u8fd1\uff0c\u6211\u4eec\u516c\u53f8\u5f00\u59cb\u5185\u7f51\u9879\u76ee\u53d8\u9769\uff0c\u5f00\u59cb\u57fa\u4e8eChrome\u7b49\u73b0\u4ee3\u6d4f\u89c8\u5668\u8fdb\u884c\u5185\u7f51\u5f00\u53d1\uff08\u5f53\u7136\uff0cIE\u6d4f\u89c8\u5668\u4e5f\u662f\u53ef\u4ee5\u4f7f\u7528\u7684\uff09\uff0c\u5185\u90e8\u5de5\u4f5c\u4eba\u5458\u5f3a\u5236\u4f7f\u7528Chrome\u6d4f\u89c8\u5668\u3002\u5c31\u6211\u4eec\u516c\u53f8\u800c\u8a00\uff0c\u53cd\u54cd\u5f88\u4e0d\u9519\uff0c\u65e0\u8bba\u662fUI\u6548\u679c\uff0c\u4ea4\u4e92\u8fd8\u662f\u901f\u5ea6\u65b9\u9762\u7684\u4f53\u9a8c\u90fd\u53cd\u9988\u4e0d\u9519\u3002<\/p>\n<p>\u663e\u7136\uff0c\u81f3\u5c11\u5728\u6211\u4eec\u516c\u53f8\uff0c\u4ee5\u540e\u8981\u7ed9\u5185\u7f51\u7684\u7f16\u8f91\u6216\u662f\u5c0f\u79d8\u4e66\u4eec\u505a\u4e2a\u591a\u56fe\u4e0a\u4f20\u7684\u529f\u80fd\uff0c\u5c31\u76f4\u63a5\u53ef\u4ee5\u4f7f\u7528HTML5\u6587\u4ef6\u4e0a\u4f20\u4e86\uff0c\u4e5f\u5c31\u662f\u672c\u6587\u6240\u8bf4\u7684\u5185\u5bb9\u3002\u7b80\u5355\uff0c\u901f\u5ea6\uff0c\u5feb\u6377\uff0c\u4f1a\u8ba9\u4f60\u4f53\u4f1a\u5230\u5f00\u53d1\u662f\u4ef6\u5feb\u4e50\u800c\u6709\u4ef7\u503c\u611f\u7684\u4e8b\u60c5\u3002<\/p>\n<p>\u8865\u5145\u8bf4\u4e0b\uff0c\u672c\u6587\u7684demo\u9875\u9762\u66f4\u591a\u7684\u662f\u7528\u6765\u793a\u4f8b\uff0c\u5176\u4e2d\u82e5\u6709\u7eb0\u6f0f\u8fd8\u671b\u89c1\u8c05\u3002<code>zxxFile.js<\/code>\u4e5f\u662f\u521a\u521a\u51fa\u7089\uff0c\u672a\u7ecf\u5386\u7ec3\u3002\u6b22\u8fce\u63d0\u51fa\u5b9d\u8d35\u610f\u89c1\uff0c\u4e0d\u751a\u611f\u8c22\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u591a\u56fe\u7247\u4e0a\u4f20\u6848\u4f8b\u548c\u4e0b\u8f7d \u4e00\u3001\u5173\u4e8e\u56fe\u7247\u4e0a\u4f20\u4ec0\u4e48\u4ec0\u4e48\u7684 \u5728XHTML\u7684\u65f6\u4ee3\uff0c\u6211\u4eec\u4f7f\u7528HTML file\u63a7\u4ef6\u4e0a\u4f20\u56fe\u7247\u4e00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,11],"tags":[],"class_list":["post-4754","post","type-post","status-publish","format-standard","hentry","category-php","category-11"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/4754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4754"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/4754\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}