diff --git a/miniYoutube/play.html b/miniYoutube/play.html index 07e8258..1285b76 100755 --- a/miniYoutube/play.html +++ b/miniYoutube/play.html @@ -148,10 +148,9 @@ xmlhttp.send(); } - function loadcomment() { + function LoadComments() { var xmlDoc; var xmlhttp; - //document.getElementById("views").innerHTML="232"; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } @@ -161,21 +160,34 @@ xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { - xmlDoc = xmlhttp.responseText; - - - - } + xmlDoc = xmlhttp.responseXML; + var i; + var con = xmlDoc.getElementsByTagName("contents"); + var nam = xmlDoc.getElementsByTagName("name"); + var tim = xmlDoc.getElementsByTagName("time"); + for(i=0;i"; + document.getElementById("ShowCom").innerHTML += "

"+con[i].childNodes[0].nodeValue+"

"; + } + else { + document.getElementById("ShowCom").innerHTML += "

"+nam[i].childNodes[0].nodeValue+" "+tim[i].childNodes[0].nodeValue+"

"; + document.getElementById("ShowCom").innerHTML += "

"+con[i].childNodes[0].nodeValue+"

"; + } + } + } } - - xmlhttp.open("GET","./lib/jsp/loadComment.jsp?vid="+vid,true); + xmlhttp.open("GET","./lib/jsp/loadComment.jsp?vid="+vid,false); + //xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.send(); } $(document).ready(function(){ window.onload=checkSession(); window.onload=loadvideo(); - window.onload=loadcomment(); + window.onload=LoadComments(); }); @@ -265,8 +277,7 @@

Comments

-
- +
Timed
@@ -350,4 +361,4 @@

Comments

- \ No newline at end of file +