国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > WEB開發(fā) > 正文

js對(duì)象爆炸的簡(jiǎn)單示例

2024-04-27 15:09:45
字體:
供稿:網(wǎng)友
     <h1>文件上傳與對(duì)象爆炸的簡(jiǎn)單案例</h1>     <script>                var id = 0;        startUpload = function( uploadType, files ){           for( var i = 0, file; file = files[ i++ ]; ){              var uploadObj = new Upload( uploadType, file.fileName, file.fileSize );              uploadObj.init( id++ );           }        };                var Upload = function( uploadType, fileName, fileSize ){            this.uploadType = uploadType;            this.fileName = fileName;            this.fileSize = fileSize;            this.dom = null;        };                Upload.PRototype.init = function( id ){           var that = this;           this.id = id;           this.dom = document.createElement("div");           this.dom.innerHTML =                          '<span>文件名稱:' + this.fileName + ', 文件大小:' + this.fileSize + '</span>' +                         '<button class="delFile">刪除</button>';           this.dom.querySelector( '.delFile' ).onclick = function(){              that.delFile();           };           document.body.appendChild( this.dom );        };                Upload.prototype.delFile = function(){           if( this.fileSize < 3000 ){              return this.dom.parentNode.removeChild( this.dom );           };                      if( confirm( "確定要?jiǎng)h除該文件么?" + this.fileName )){              return this.dom.parentNode.removeChild( this.dom );           }        };                startUpload( "plugin", [           {              fileName: "1.txt",              fileSize: 1000           },           {           	  fileName: "2.txt",              fileSize: 2000           },           {              fileName: "3.txt",              fileSize: 5000           }        ])     </script>
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 台南县| 江华| 陆河县| 漯河市| 苏尼特左旗| 蒙阴县| 朝阳县| 雅安市| 云浮市| 敦化市| 临洮县| 大厂| 平顶山市| 敖汉旗| 广丰县| 潮州市| 南涧| 迁安市| 哈尔滨市| 民权县| 阿图什市| 耒阳市| 田林县| 潍坊市| 青浦区| 乐平市| 门源| 桂阳县| 昆明市| 浙江省| 湖北省| 楚雄市| 屯留县| 肃宁县| 新建县| 芒康县| 永福县| 安塞县| 安义县| 米林县| 商河县|