2024年2月5日发(作者:)
if(XObject) { var io = Element(''); if(typeof uri== 'boolean'){ = 'javascript:false'; } else if(typeof uri== 'string'){ = uri; } } else { var io = Element('iframe'); = frameId; = frameId; } on = 'absolute'; = '-1000px'; = '-1000px'; Child(io); return io
}, createUploadForm: function(id, fileElementId) { //create form
var formId = 'jUploadForm' + id; var fileId = 'jUploadFile' + id; var form = $('
');var oldElement = $('#' + fileElementId); var newElement = $(oldElement).clone(); $(oldElement).attr('id', fileId); $(oldElement).before(newElement); $(oldElement).appendTo(form); //set attributes $(form).css('position', 'absolute'); $(form).css('top', '-1200px'); $(form).css('left', '-1200px'); $(form).appendTo('body');
return form; }, ajaxFileUpload: function(s) { // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
s = ({}, ttings, s); var id = ementId;
var form = UploadForm(id, ementId); var io = UploadIframe(id, uri); var frameId = 'jUploadFrame' + id; var formId = 'jUploadForm' + id;
// Watch for a new set of requests if ( && ! ++ ) { r( "ajaxStart" ); }
var requestDone = false; // Create the request object var xml = {}
if ( ) r("ajaxSend", [xml, s]); // Wait for a response to come back var uploadCallback = function(isTimeout) {
var io = mentById(frameId); try
{
{
if(tWindow) { seText = ?TML:null; seXML = ument?ument:nt;
}else if(tDocument) { seText = ?TML:null; seXML = ument?ument:nt; }
}catch(e) { Error(s, xml, null, e); } if ( xml || isTimeout == "timeout")
{
requestDone = true; var status; try { status = isTimeout != "timeout" ? "success" : "error"; // Make sure that the request was successful or notmodified if ( status != "error" ) { // process the data (runs the xml through httpData regardless of callback) var data = HttpData( xml, pe );
// If a local callback was specified, fire it and pass it the data if ( s ) s( data, status );
// Fire the global callback if( ) r( "ajaxSuccess", [xml, s] ); } else Error(s, xml, status); } catch(e)
{ status = "error"; Error(s, xml, status, e); } // The request was completed if( ) r( "ajaxComplete", [xml, s] ); // Handle the global AJAX counter if ( && ! -- ) r( "ajaxStop" ); // Process result if ( te ) te(xml, status); jQuery(io).unbind() setTimeout(function() { try
{ $(io).remove(); $(form).remove();
} catch(e)
{ Error(s, xml, null, e); }
本文发布于:2024-02-05 15:10:21,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170711702157292.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |