JS 动态加载页面以及ViewBag传参

<h2>JS 动态加载页面以及ViewBag传参</h2>

 1 function setchildcomment(thisa, index){
 2         if(childcomments!=null)
 3         {
 4             console.log(childcomments);
 5             var childhtml = '';
 6             for(var i=0;i<childcomments.length;i++)
 7             {
 8                 childhtml +='<div class="ff-sub-cmt col-md-offset-1 col-xs-offset-1">';
 9                 childhtml +='<div class="ff-sub-cmt-bar">';
10                 childhtml +='<div class="ff-sub-u-name">';
11                 childhtml +='<span style="float:left;">'+childcomments[i].userName+'&nbsp;&nbsp;:&nbsp;&nbsp;</span>';
12                 childhtml +='<span style="width: 500px; white-space: normal; word-wrap: break-word; display: inline-block; ">'+childcomments[i].commentText+'</span>';
13                 childhtml +='<a class="sub-reply" onclick="huifu(this, 2)">回复</a>';
14                 childhtml +='</div>';
15                 childhtml +='<div class="row huifu" style="margin: 10px; display:none;">';
16                 childhtml +='<textarea class="textarea-huifu" placeholder="回复:'+childcomments[i].userName+'" style="width: 90%; resize: none;" data-reply-pid></textarea>';
17                 childhtml +='<button class="btn-fw btn btn-default" style="width: 10%;float:right;height:45px;" onclick="subminHuifu(this,@ViewBag.ArticleId,'+childcomments[i].parentId+', '+index+', \''+childcomments[i].userName+'\', \''+childcomments[i].commentText+'\')">回复</button>';
18                 childhtml +='</div>';
19                 childhtml +='</div>';
20                 childhtml +='</div>';
21             }
22 
23             var childdiv = $(".ff-cmt:eq(" + index + ") .lookmore");
24             $(childdiv).before(childhtml);
25             if(!childcomments[0].isMoreChild)//隐藏查看更多链接
26             {
27                 thisa.style.display = "none";
28             }
29             childcomments  = null;
30         }
31     }

 

posted on 2017-08-22 14:46  梦林``ysl  阅读(478)  评论(0编辑  收藏  举报

导航