From 55a36ddf736196caafb39bbff291a52b1e318897 Mon Sep 17 00:00:00 2001
From: JimZyq
Date: Tue, 29 Nov 2016 03:42:53 +0900
Subject: [PATCH] loadcomments
---
miniYoutube/play.html | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
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"+nam[i].childNodes[0].nodeValue+" "+tim[i].childNodes[0].nodeValue+"
";
+ 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 @@ Do you want to report this video?
-