ajax php多文件上传代码
- <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title>ajax php多文件上传代码</title>
- <script>
- (function(){
-
- var d = document, w = window;
-
-
-
- function get(element){
- if (typeof element == "string")
- element = d.getelementbyid(element);
- return element;
- }
-
-
-
- function addevent(el, type, fn){
- if (w.addeventlistener){
- el.addeventlistener(type, fn, false);
- } else if (w.attachevent){
- var f = function(){
- fn.call(el, w.event);
- };
- el.attachevent('on' + type, f)
- }
- }
-
-
-
-
- var toelement = function(){
- var div = d.createelement('div');
- return function(html){
- div.innerhtml = html;
- var el = div.childnodes[0];
- div.removechild(el);
- return el;
- }
- }();
- function hasclass(ele,cls){
- return ele.classname.match(new regexp('(s|^)'+cls+'(s|$)'));
- }
- function addclass(ele,cls) {
- if (!hasclass(ele,cls)) ele.classname += " "+cls;
- }
- function removeclass(ele,cls) {
- var reg = new regexp('(s|^)'+cls+'(s|$)');
- ele.classname=ele.classname.replace(reg,' ');
- }
-
- if (document.documentelement["getboundingclientrect"]){
-
-
- var getoffset = function(el){
- var box = el.getboundingclientrect(),
- doc = el.ownerdocument,
- body = doc.body,
- docelem = doc.documentelement,
-
-
- clienttop = docelem.clienttop || body.clienttop || 0,
- clientleft = docelem.clientleft || body.clientleft || 0,
-
-
-
-
- zoom = 1;
-
- if (body.getboundingclientrect) {
- var bound = body.getboundingclientrect();
- zoom = (bound.right - bound.left)/body.clientwidth;
- }
-
- if (zoom > 1){
- clienttop = 0;
- clientleft = 0;
- }
-
- var top = box.top/zoom + (window.pageyoffset || docelem && docelem.scrolltop/zoom || body.scrolltop/zoom) - clienttop,
- left = box.left/zoom + (window.pagexoffset|| docelem && docelem.scrollleft/zoom || body.scrollleft/zoom) - clientleft;
-
- return {
- top: top,
- left: left
- };
- }
-
- } else {
-
- var getoffset = function(el){
- if (w.jquery){
- return jquery(el).offset();
- }
-
-
|