<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title></title>
<link href= ". /bootstrap-3.3.5-dist/css/bootstrap.css "rel=" stylesheet "/>
<link href= ". /kindeditor-4.1.10/themes/default/default.css "rel=" stylesheet "/>
<script src= ". /bootstrap-3.3.5-dist/js/jquery-1.10.2.min.js "></script>
<script src= ". /bootstrap-3.3.5-dist/js/bootstrap.min.js "></script>
<script src= ". /kindeditor-4.1.10/kindeditor-min.js "></script>
<script src= ". /kindeditor-4.1.10/lang/zh_cn.js "></script>
<style type= "Text/css" >
. Comment {
position:relative;
/*width:330px;*/
padding:10px;
}
. comment. Ke-toolbar {
/*position:absolute;*/
/*bottom:6px;*/
}
. btn_pl {
Display:block;
Float:right;
}
</style>
<body>
<div class= "Container" style= "margin-top:50px" >
<form class= "Form-horizontal" >
<!--<textarea class= "Form-control" rows= "3" id= "PL" ></textarea>-->
<div class= "Row" >
<div class= "comment col-md-10 col-md-offset-1" >
<textarea class= "Form-control" name= "content" id= "PL" > Reply comments </textarea>
<input type= "button" value= "comments" name= "BTN_PL" class= "btn_pl form" style= "margin-top:7px"/>
</div>
</div>
<div class= "Row col-md-11" >
<div class= "col-md-offset-1" style= "margin-top:20px" id= "pls" >
<!--<ul id= "pls" ></ul>-->
</div>
</div>
</form>
</div>
<script type= "Text/javascript" >
var datas = [
{
ID: ' 1 ',
PID: ",
Cont: ' AAA ',
User: ' AAA ',
UserId: ' SDG '
},
{
ID: ' 2 ',
PID: ",
Cont: ' BBB ',
User: ' RTW ',
UserId: ' 213 '
},
{
ID: ' 4 ',
PID: ' 2 ',
Cont: ' DD ',
User: ' DF ',
UserId: ' 1adf4 '
},
{
ID: ' 5 ',
PID: ' 1 ',
Cont: ' EE ',
User: ' DDS ',
UserId: ' 2fa34 '
},
{
ID: ' 3 ',
PID: ' 5 ',
Cont: ' CCC ',
User: ' 123 ',
UserId: ' 123TG4 '
}
]
Kinder Initialization
var editor;
Kindeditor.ready (function (K) {
Editor = k.create (' textarea[name= ' content "] ', {
Resizetype:1,
Allowpreviewemoticons:false,
Allowimageupload:false,
Width: "100%",
Items: [
' Emoticons ', ' image ', ' link '
});
});
$ (function () {
Load comments
$.get ("", "", function (res) {
if ();
for (var i = 0; i < datas.length; i++) {
HTMLText = "<div id=" + datas[i].id + "' style= ' border-bottom:solid #0096ff 1px ' >"
+ Datas[i].cont
+ "<div class= ' col-md-offset-8 ' >"
+ "Comment Person:"
+ "<span class= ' user_pl ' >" + datas[i].user + "</span>"
+ "+ " "
+ "<span class= ' date_pl ' >" + getDate () + "<span/>"
+ "</div>"
+ "<div class= ' col-md-offset-10 ' >"
+ "<a href= ' # ' onclick= ' Replay (this) ' > Reply </a>"
+ "</div>"
+ "<div class= ' hidden ' >"
+ "<form>"
+ "<!--<textarea class= ' Form-control ' rows= ' 3 ' class= ' pl ' ></textarea>-->"
+ "<div class= ' comment ' >"
+ "<textarea class= ' form-control ' name= ' content ' class= ' pl ' > Reply to Comments </textarea>"
+ "<input type= ' button ' value= ' reviews ' name= ' btn_pl ' class= ' btn_pl ' style= ' margin-top:7px ' onclick= '" replayok (This) '/ > "
+ "</div>"
+ "</form>"
+ "</div>"
+ "</div>"
$ ("#pls"). Append (HTMLText);
}
});
Binding Comment Events
$ (". Btn_pl"). Unbind ("click"). Bind ("click", Function () {
if ($ (". Pl"). val () = = "" | | $ (". Pl"). val () = = null) {
Return
}
HTMLText = "<div style= ' border-bottom:solid #0096ff 1px ' >"
+ $ (". Pl"). Val ()
+ "<div class= ' col-md-offset-8 ' >"
+ "Comment Person:"
+ "Admin"
+ " "
+ getDate ()
+ "</div>"
+ "<div class= ' col-md-offset-10 ' >"
+ "<a href= ' # ' onclick= ' Replay (this) ' > Reply </a>"
+ "</div>"
+ "<div class= ' hidden ' >"
+ "<form>"
+ "<!--<textarea class= ' Form-control ' rows= ' 3 ' id= ' pl ' ></textarea>-->"
+ "<div class= ' comment ' >"
+ "<textarea class= ' form-control ' name= ' content ' class= ' pl ' > Reply to Comments </textarea>"
+ "<input type= ' button ' value= ' reviews ' name= ' btn_pl ' class= ' btn_pl ' style= ' margin-top:7px ' onclick= '" replayok (This) '/ > "
+ "</div>"
+ "</form>"
+ "</div>"
+ "</div>"
$ (". Pl"). Append (HTMLText);
});
});
Click the Reply button
Function Replay (t) {
Self = $ (t);
if (Self.parent (). Next (). Hasclass (' hidden ')) {
Self.parent (). Next (). Removeclass ("hidden");
} else {
Self.parent (). Next (). addclass ("hidden");
}
var editor;
Kindeditor.ready (function (K) {
Editor = k.create (' textarea[name= ' content "] ', {
Resizetype:1,
Allowpreviewemoticons:false,
Allowimageupload:false,
Width: "100%",
Items: [
' Emoticons ', ' image ', ' link '
});
Comment Person
user = Self.parent (). Prev (). Children (". User_pl"). Text ();
Comment Person ID
UserId = Self.parent (). Prev (). Children (". UserId"). attr ("value");
Comment Content
Cont = Self.parent (). Parent (). text ();
Comment ID
Contid = Self.parent (). Parent (). attr ("id");
Alert ("Comment person" + user + "---reviewer ID" + userId + "---comment" + cont + "--Comment Content ID" + contid)
});
}
Reply Click OK button
function Replayok (t) {
HTMLText = "<div style= ' border-bottom:solid #0096ff 1px ' >"
+ $ (". Pl"). Val ()
+ "<div class= ' col-md-offset-8 ' >"
+ "Comment Person:"
+ "Admin"
+ " "
+ getDate ()
+ "</div>"
+ "<div class= ' col-md-offset-10 ' >"
+ "<a href= ' # ' onclick= ' Replay (this) ' > Reply </a>"
+ "</div>"
+ "<div class= ' hidden ' >"
+ "<form>"
+ "<!--<textarea class= ' Form-control ' rows= ' 3 ' id= ' pl ' ></textarea>-->"
+ "<div class= ' comment ' >"
+ "<textarea class= ' form-control ' name= ' content ' class= ' pl ' > Reply to Comments </textarea>"
+ "<input type= ' button ' value= ' reviews ' name= ' btn_pl ' class= ' btn_pl ' style= ' margin-top:7px ' onclick= '" replayok (This) '/ > "
+ "</div>"
+ "</form>"
+ "</div>"
+ "</div>"
}
Get current time
function GetDate () {
var d = new Date ()
var vyear = D.getfullyear ()
var Vmon = d.getmonth () + 1
var VDay = D.getdate ()
var h = d.gethours ();
var m = d.getminutes ();
var se = d.getseconds ();
return s = vyear + "-" + (Vmon < 10?) "0" + Vmon:vmon + "-" + (VDay < 10?) "0" + vday:vday) + "" + (H < 10?) 0 "+ h:h) +": "+ (M < 10?) 0 "+ m:m) +": "+ (SE < 10?) 0 "+ se:se);
}
</script>
</body>
Comment Feature---New