node.js 层楼评论
评论mongodb增删改查 短信验证 socket.io聊天 sh /root/ robomongoajax异步调用 短信验证 在线聊天 JavaScript序列化对象serialize session req.session商品首页、详情页、列表页用mongodb交互实现 express商品详情页写一个评论。1.准备测试的Json数据:var a = [ { "id": "1", "Name": "caoyuan", "Time": "201608230720", "Content": "今天天气好" }, { "id": "2", "Name": "cao", "Time": "201608230722", "Content": "这是1楼" }, { "id": "3", "Name": "yuan", "Time": "201608230723", "Content": "这是2楼" }, { "id": "4", "Name": "caoxuan", "Time": "201608230724", "Content": "这是3楼" }];1 、样式.commentbox{
border:1px solid #ccc;
padding: 10px;
margin: 2px;
}
拼接var a = [ { "id": "1", "Name": "caoyuan", "Time": "201608230720", "Content": "今天天气好" }, { "id": "2", "Name": "cao", "Time": "201608230722", "Content": "这是1楼" }, { "id": "3", "Name": "yuan", "Time": "201608230723", "Content": "这是2楼" }, { "id": "4", "Name": "caoxuan", "Time": "201608230724", "Content": "这是3楼" }];var result = ""; result += "
";for(var i=1;i";};for(var i=1;i
";};result += "
"+a[0].Content+"
";document.getElementById("pl").innerHTML = result;