2009-07-17 76 views
1

我有以下JavaScript代碼,它是從SWFUpload中的SimpleUpload演示修改的。它用於生成臨時上傳進度條。它工作正常,除非我添加已被註釋掉的代碼。基本上,這一行將打破演示文稿:使用javascript添加html元素使其他js wonky

this.fileProgressElement.appendChild(document.createTextNode(「Upload Status」));

演示:嘗試上傳。上傳功能不起作用。
http://www.mgxvideo.com/mgxcopy-dev/uploader-works/upload_files.php
http://www.mgxvideo.com/mgxcopy-dev/uploader-broken/upload_files.php

的代碼爲:
http://www.mgxvideo.com/mgxcopy-dev/uploader-works/js/sample1.txt
http://www.mgxvideo.com/mgxcopy-dev/uploader-broken/js/sample1.txt

function FileProgress(file, targetID) { 
    this.fileProgressID = file.id; 

    this.opacity = 100; 
    this.height = 0; 


    this.fileProgressWrapper = document.getElementById(this.fileProgressID); 
    if (!this.fileProgressWrapper) { 
     this.fileProgressWrapper = document.createElement("div"); 
     this.fileProgressWrapper.className = "progressWrapper"; 
     this.fileProgressWrapper.id = this.fileProgressID; 

     this.fileProgressElement = document.createElement("div"); 
     this.fileProgressElement.className = "progressContainer"; 
     //this.fileProgressElement.appendChild(document.createTextNode("Upload Status")); 

     var progressCancel = document.createElement("a"); 
     progressCancel.className = "progressCancel"; 
     progressCancel.href = "#"; 
     progressCancel.style.visibility = "hidden"; 
     progressCancel.appendChild(document.createTextNode(" ")); 

     var progressText = document.createElement("div"); 
     progressText.className = "progressName"; 
     progressText.appendChild(document.createTextNode(file.name)); 

     var progressBar = document.createElement("div"); 
     progressBar.className = "progressBarInProgress"; 

     var progressStatus = document.createElement("div"); 
     progressStatus.className = "progressBarStatus"; 
     progressStatus.innerHTML = " "; 

     var progressFull = document.createElement("div"); 
     progressFull.className = "progressBarFull"; 
     progressFull.innerHTML = " "; 

     this.fileProgressElement.appendChild(progressCancel); 
     this.fileProgressElement.appendChild(progressText); 
     this.fileProgressElement.appendChild(progressStatus); 
     this.fileProgressElement.appendChild(progressBar); 
     this.fileProgressElement.appendChild(progressFull); 
     this.fileProgressWrapper.appendChild(this.fileProgressElement); 

     document.getElementById(targetID).appendChild(this.fileProgressWrapper); 
    } else { 
     this.fileProgressElement = this.fileProgressWrapper.firstChild; 
     this.reset(); 
    } 

    this.height = this.fileProgressWrapper.offsetHeight; 
    this.setTimer(null); 


} 
+1

「此行將打破演示文稿」以什麼方式打破?我已經使用Firefox 3.0.x和IE8測試了兩個版本,並沒有發現任何明顯的錯誤/錯誤。 – VolkerK 2009-07-17 10:20:14

回答

0

請問以下工作更好嗎?

​​
相關問題