下载

0下载券

加入VIP
  • 专属下载券
  • 上传内容扩展
  • 资料优先审核
  • 免费资料无限下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 用SSH+ajax实现的上传进忍em,仿qq邮箱的大文件上传窗体

用SSH+ajax实现的上传进忍em,仿qq邮箱的大文件上传窗体.doc

用SSH+ajax实现的上传进忍em,仿qq邮箱的大文件上传窗体

梦_足以致命
2017-09-18 0人阅读 举报 0 0 0 暂无简介

简介:本文档为《用SSH+ajax实现的上传进忍em,仿qq邮箱的大文件上传窗体doc》,可适用于战略管理领域

用SSHajax实现的上传进忍em,仿qq邮箱的大文件上传窗体用SSHajax实现的上传进度条仿qq邮箱的大文件上传窗体使用说明:界面显示:直接调用sAlert(txt)txt是参数。后台支持:varurl="progressdo"这一句是后台action的名称。所以必须在服务器端有这个action。当然你也可以改掉这个URL。net,asp,和jsp可以相应的改掉这个urL即可。另外在后台的服务类里写回应的XML的时候必须包括以下三个标签<filelength>值<filelength>,,<readbytes>值<readbytes>,<pgs>值<pgs>以下为JavaScript。<scripttype="textjavascript"language="javascript">varcountByte="B"varicountByte=varreadByte="B"varireadByte=varspeed="bs"varispeed=varpgs=""vari=varldate=newDate()vardate=newDate()varxmlHttpvarkeyfunctionsAlert(txt){i=if(windowActiveXObject){xmlHttp=newActiveXObject("MicrosoftXMLHTTP")}elseif(windowXMLHttpRequest){xmlHttp=newXMLHttpRequest()}vareSrc=(documentall)windoweventsrcElement:argumentsvarshield=documentcreateElement("DIV")shieldid="shield"shieldstyleposition="absolute"shieldstyleleft="px"shieldstyletop="px"shieldstylewidth=""shieldstyleheight=((documentdocumentElementclientHeight>documentdocumentElementscrollHeight)documentdocumentElementclientHeight:documentdocumentElementscrollHeight)"px"shieldstylebackground="#"shieldstyletextAlign="center"shieldstylezIndex=""shieldstylefilter="alpha(opacity=)"shieldstyleopacity=varalertFram=documentcreateElement("DIV")alertFramid="alertFram"alertFramstyleposition="absolute"alertFramstyleleft=""alertFramstyletop=""alertFramstylemarginLeft="px"alertFramstylemarginTop=documentdocumentElementscrollTop"px"alertFramstylewidth="px"alertFramstyleheight="px"alertFramstylebackground="#fff"alertFramstyletextAlign="center"alertFramstylelineHeight="px"alertFramstylezIndex=""strHtml="<ulstyle="liststyle:nonemargin:pxpadding:pxwidth:px">"strHtml="<listyle="background:#BBBtextalign:leftpaddingleft:pxfontsize:pxfontweight:boldheight:pxlineheight:pxborder:pxsolid#BBB">文件上传<li>"strHtml="<listyle="background:#ffftextalign:leftpaddingleft:pxpaddingtop:pxfontsize:pxheight:pxlineheight:pxborderleft:pxsolid#BBBborderright:pxsolid#BBB">"txt"<li>"strHtml="<listyle="background:#ffftextalign:centerpaddingtop:pxfontsize:pxheight:pxlineheight:pxborderleft:pxsolid#BBBborderright:pxsolid#BBB"><tableid="pbar"width=""height=""border=""cellspacing=""cellpadding=""bordercolor="#BBB"><tr><td><tablewidth=""border=""cellspacing=""cellpadding=""><tr><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tdid="l"><td><tr><table><td><tr><table><br><divid="progress">文件总量:"countByte"已上传:"readByte"上传速度:"speed"上传进度:"pgs"<div><br><li>n"strHtml="<li"background:#CEBtextalign:rightpaddingright:pxfontwstyle=eight:boldheight:pxlineheight:pxborder:pxsolid#BBB"><inputtype="button"value="确定"id="doOK"onclick="doOk()"><inputtype="button"value="取消"id="doCancle"onclick="doCancle()"><li>n"strHtml="<ul>n"alertFraminnerHTML=strHtmldocumentbodyappendChild(alertFram)documentbodyappendChild(shield)thissetOpacity=function(obj,opacity){if(opacity>=)opacity=opacitytry{objstyleopacity=opacity}catch(e){}try{if(objfilterslength>objfilters("alpha")){objfilters("alpha")opacity=opacity*}else{objstylefilter="alpha(opacity=""(opacity*)"")"}}catch(e){}}varc=thisdoAlpha=function(){if(c>){clearInterval(ad)return}setOpacity(shield,c)}varad=setInterval("doAlpha()",)thisdoOk=function(){alertFramstyledisplay="none"shieldstyledisplay="none"documentbodyremoveChild(alertFram)documentbodyremoveChild(shield)eSrcfocus()varurl="progressdo"xmlHttpopen("post",url,true)xmlHttpsend()documentbodyonselectstart=function(){returntrue}documentbodyoncontextmenu=function(){returntrue}}thisdoCancle=function(){documentbodyremoveChild(alertFram)documentbodyremoveChild(shield)eSrcfocus()documentbodyonselectstart=function(){returntrue}documentbodyoncontextmenu=function(){returntrue}}documentgetElementById("doOK")focus()eSrcblur()xmlHttponreadystatechange=showprogress()documentbodyonselectstart=function(){returnfalse}documentbodyoncontextmenu=function(){returnfalse}}functionshowprogress(){varurl="progressdo"xmlHttpopen("post",url,true)xmlHttponreadystatechange=updatexmlHttpsetRequestHeader("IfModifiedSince","")xmlHttpsend()}functionupdate(){try{if(xmlHttpreadyState==){if(xmlHttpstatus==){varfilelegth=xmlHttpresponseXMLgetElementsByTagName("filelength")firstChilddatavarreadbytes=xmlHttpresponseXMLgetElementsByTagName("readbytes")firstChilddatavarpgs=xmlHttpresponseXMLgetElementsByTagName("pgs")firstChilddatavaripreadByte=parseInt(readbytes)varipcountByte=parseInt(filelegth)文件长度单位转化if(ipcountByte>=**){countByte=subnumber(ipcountByte(**),,)"GB"}else{if(ipcountByte>=*){countByte=subnumber(ipcountByte(*),,)"MB"}else{if(ipcountByte>=){countByte=subnumber(ipcountByte,,)"KB"}else{countByte=ipcountByte"B"}}}已上传长度单位转化if(ipreadByte>=**){readByte=subnumber(ipreadByte(**),,)"GB"}else{if(ipreadByte>=*){readByte=subnumber(ipreadByte(*),,)"MB"}else{if(ipreadByte>=){readByte=subnumber(ipreadByte,,)"KB"}else{readByte=ipreadByte"B"}}}速度单位转化varispeed=(ipreadByteireadByte)if(ispeed>=**){speed=subnumber(ispeed**,,)"GBs"}else{if(ispeed>=*){speed=subnumber(ispeed*,,)"MBs"}else{if(ispeed>=){speed=subnumber(ispeed,,)"KBs"}else{speed=ispeed"Bs"}}}ireadByte=ipreadByte保存上次的上传量icountByte=ipcountByte保存文件长度pgs=pgs更新进度在服务端进行了计算得到varunits=icountByte分割文件为份为单元格的个数varmodunits=ireadByteunits这两句varreadunits=(ireadBytemodunits)units是用来计算整除好显示出来for(i=i<=readunitsi){for循环是用来更新图片的。用for可以防止漏画documentgetElementById("l"i)stylebackgroundColor="#ADD"}}}}catch(err){alert(errname":"errmessage""xmlHttpreadyState)}varprogress="文件总量:"countByte"已上传:"readByte"上传速度:"speed"上传进度:"pgs""documentgetElementById("progress")innerHTML=progresssetTimeout("showprogress()",)}functionsubnumber(number,start,end){varSnumber=number""Snumber=Snumbersubstring(start,end)returnnewNumber(Snumber)}<script>

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

评分:

/9

VIP

意见
反馈

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利