prototype操作ajax的高难度问题(在线等)

wangdongzjk wangdongzjk 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
var JSUpload = Class.create();

JSUpload.prototype = {
initialize : function(form){
this.theUniqueID = 0;
this.processDone = $("PercentDone"); //process bar
this.totalSize = $("TotalSize");
this.sizeComplete = $("SizeCompleted");
this.transferRate = $("TransferRate");
this.elapsedTime = $("ElapsedTime");
this.timeLeft = $("TimeLeft");

this.iframe = $("ifame_upload");
this.bar = $("bar");

this._form = form;
this._action = "/humanreport/smartUpload";

this.oXmlDoc = Ajax.getTransport();
},

uploadData : function(){
this.theUniqueID = (new Date()).getTime() % 1000000000;

this.processDone.style.width = 0;
this.totalSize.innerHTML = "";
this.sizeComplete.innerHTML = "";
this.transferRate.innerHTML = "";
this.elapsedTime.innerHTML = "";
this.timeLeft.innerHTML = "";
this._form.action = this._action;
//this._form.target = $("ifame_upload");
this._form.submit();

this.processBar();
},

processBar : function(){
var url = "/humanreport/smartUploadXml";
var pars = "tmp=" + Math.random();
var processAjax = new Ajax.Request(
url,{method : 'post',parameters : pars,onComplete : this.loadComplete}
);
},

loadComplete : function(originalRequest){
try{
var root;
if(window.DOMParser){
var parser = new DOMParser();
root = parser.parseFromString(text, "text/xml");
}

if (window.ActiveXObject){
var doc = Try.these(
function() { return new ActiveXObject('MSXML2.DomDocument') },
function() { return new ActiveXObject('Microsoft.DomDocument')},
function() { return new ActiveXObject('MSXML.DomDocument') },
function() { return new ActiveXObject('MSXML3.DomDocument') },
function() { return new ActiveXObject('Microsoft.XMLDOM') }
) || null;
doc.async = false;
doc.loadXML(originalRequest.responseText);
if(doc.parseError.errorCode != 0)
root = null;
else{
root = doc;
}
}

if(root !== null){
var iTimerID;
if(root.selectSingleNode("errMessage") === null){
var readState = root.selectSingleNode("//ReadyState").text;
$('textarea').innerHTML = readState;
if(readState == "uninitialized"){
iTimerID = new PeriodicalExecuter(JSUpload.processBar,100);
}
else if(readState == "loading"){
$("bar").style.display = 'block';
$("PercentDone").style.width = root.selectSingleNode("//Percentage").text;
$("TotalSize").innerHTML = root.selectSingleNode("//TotalSize").text;
$("SizeCompleted").innerHTML = root.selectSingleNode("//SizeCompleted").text;
$("TransferRate").innerHTML = root.selectSingleNode("//TransferRate").text;
$("ElapsedTime").innerHTML = root.selectSingleNode("//ElapsedTime").text;
$("TimeLeft").innerHTML = root.selectSingleNode("//TimeLeft").text;
iTimerID = new PeriodicalExecuter(JSUpload.processBar,100);
}
else if(readState == "loaded"){
$("PercentDone").style.width = "100%";
iTimerID = null;
alert("upload complete, handling...");
}
else{
iTimerID = null;
alert("complete");
}
}
else{
alert(root.selectSingleNode("//ErrorMessage").text);
}
}
}
catch(e){
alert(e.description + "\n" + ":" + (e.number & 0xFFFF));
}
}
};

iTimerID = new PeriodicalExecuter(JSUpload.processBar,100);这段代码怎样才等调用JSUpload的processBar函数?
...全文

相关推荐

Android无缝替换Dalvik虚拟机中文最新版本

本文档主要讲述的是Android无缝替换Dalvik虚拟机;Dalvik虚拟机实则也算是一个Java虚拟机,只不过它执行的不是class文件,而是dex文件。因此,ART运行时最理想的方式也是实现为一个Java虚拟机的形式,这样就可以很容易地将Dalvik虚拟机替换掉。希望本文档会给有需要的朋友带来帮助;感兴趣的朋友可以过来看看

乔丹搞Python+AI

Dalvik虚拟机 PPT版

Android应用程序是运行在Dalvik虚拟机里面的,并且每一个应用程序对应有一个单独的Dalvik虚拟机实例。Android应用程序中的Dalvik虚拟机实例实际上是从Zygote进程的地址空间拷贝而来的,这样就可以加快Android应用程序的启动速度。Dalvik虚拟机与Java虚拟机共享有差不多的特性,例如,它们都是解释执行,并且支持即时编译(JIT)、垃圾收集(GC)、Java本地方法调用(JNI)和Java远程调试协议(JDWP)等,差别在于两者执行的指令集是不一样的,并且前者的指令集是基本寄存器的,而后者的指令集是基于堆栈的。这个PPT讲Dalvik虚拟机的内存管理、垃圾收集、即时编译、Java本地调用、进程和线程管理等。理解Dalvik虚拟机的上述实现细节,有助于在运行时修改程序的行为,例如,拦截Java函数的调用。

罗升阳

Android虚拟机Dalvik完整源码

Android虚拟机Dalvik完整源码,宝贵资源,欢迎下载! This directory contains the Dalvik virtual machine and core class library, as well as related tools, libraries, and tests. A note about the licenses and header comments --------------------------------------------- Much of the code under this directory originally came from the Apache Harmony project, and as such contains the standard Apache header comment. Some of the code was written originally for the Android project, and as such contains the standard Android header comment. Some files contain code from both projects. In these cases, the header comment is a combination of the other two, and the portions of the code from Harmony are identified as indicated in the comment. Here is the combined header comment: /* * Copyright (C) The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * ---------- * * Portions of the code surrounded by "// BEGIN Harmony code" and * "// END Harmony code" are copyrighted and licensed separately, as * follows: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Native SH call bridge --------------------- Native SH call bridge is written by Shin-ichiro KAWASAKI and Contributed to Android by Hitachi, Ltd. and Renesas Solutions Corp.

eeagle518

Android虚拟机Dalvik(略谈Android Dalvik虚拟机)

Android虚拟机Dalvik(略谈Android Dalvik虚拟机)

地狱怒兽

进入 Android Dalvik 虚拟机

进入 Android Dalvik 虚拟机,android dalvik介绍 Dalvik 虚拟机的特点——掌握 Android 程序的运行原理 Android 系统的架构采用分层思想,这样的好处是拥有减少各层之间的依赖性、便于独 立分发、容易收敛问题和错误等优点。Android 系统由 Linux 内核、函数库、Android 运行时、 应用程序框架以及应用程序组成。如图 3-4 的 Android 系统架构所示,Dalvik 虚拟机属于 Android 运行时环境,它与一些核心库共同承担 Android 应用程序的运行工作。

小二哥m
评论 11
收藏 已收藏
分享
返回顶部
wangdongzjk
基础编程 21,889 成员 140,329 内容