Code: Alles auswählen
$str = str_replace('[video-'.$row['id'].']', '<div id="video_content_'.$row['id'].'"> wird geladen ... </div><SCRIPT LANGUAGE="JavaScript">loadVideo('.$row['id'].');</SCRIPT>', $str);
Code: Alles auswählen
function loadVideo(vid)
{
url = 'videoplayer.php?file_id=' + vid;
if (xmlHttp) {
xmlHttp.open('GET', url, true);
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4) {
document.getElementById("video_content_" + vid).innerHTML = xmlHttp.responseText;
}
};
xmlHttp.send(null);
}
}
Folgendes Problem: Es funktioniert nur dann, wenn im Text 1 Video eingeblendet werden soll. Sobald ein 2. Video hinzukommt, läd die Funktion nur noch das letzte Video nach. Ich vermute es liegt daran, dass das Javascript "loadVideo" mehrfach ausgeführt wird.
Hat jemand eine Idee wie man das lösen könnte?
THX