Ich habe den folgenden JavaScript-Code, der von der SimpleUpload-Demo in SWFUpload geändert wird. Es wird verwendet, um einen temporären Upload-Fortschrittsbalken zu generieren. Es funktioniert gut, es sei denn, ich füge den Code, der auskommentiert wurde, hinzu. Diese Zeile unterbricht im Grunde die Präsentation:Hinzufügen eines HTML-Elements mit Javascript macht andere js wonky
this.fileProgressElement.appendChild (document.createTextNode ("Upload Status"));
Demos: Versuchen Sie den Upload. Die Upload-Funktion funktioniert nicht.
http://www.mgxvideo.com/mgxcopy-dev/uploader-works/upload_files.php
http://www.mgxvideo.com/mgxcopy-dev/uploader-broken/upload_files.php
Der Code ist:
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);
}
"Diese Zeile wird die Präsentation unterbrechen" Pause in welcher Weise? Ich habe beide Versionen mit Firefox 3.0.x und IE8 getestet und habe nichts offensichtlich kaputt/falsch gesehen. – VolkerK
die Frage, die ich in jedem DOM-Manipulationsproblem stelle: Sind Sie sicher, dass das DOM geladen ist? – geowa4
Sie erscheinen identisch mit mir: jeder zu rund 45% hochgeladen, dann eingesperrt. Das Schließen der Registerkarte hat dazu geführt, dass mein Browser für einige Sekunden eingefroren ist. Chrome 2 unter WinXP SP3. – NickFitz