JS 動態加載頁面以及ViewBag傳參
阿新 • • 發佈:2017-08-22
textarea cti use pid -name play color com art
<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+‘ : </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 }
JS 動態加載頁面以及ViewBag傳參