<style>
*{
margin: 0;
padding: 0;
}
ul{
list-style: none;
}
#box{
/*width: 30px;*/
color: skyblue;
font-size: 14px;
/*height: 40px;*/
border: 1px solid #87CEEB;
display: inline-block;
}
</style>
</head>
<body>
<button id="btn">查看评论</button>
<button id="next">下一页</button>
<div id="box">第<span>0</span>页</div>
<ul id="list">
<!--<li>从什么都没有的地方 到什么都没有的地方</li>-->
</ul>
</body>
<script>
var btn=document.querySelector('#btn');
var list=document.querySelector('#list');
var next=document.querySelector('#next');
var box=document.querySelector('#box');
var index=0;
var indexs=1;
function callback(data){
data.comments.forEach(function(v){
// console.log(v);
var newli=document.createElement('li');
newli.innerHTML=v.content;
list.appendChild(newli);
});
}
btn.οnclick=function(){
box.innerHTML='';
// index++;
var script=document.createElement('script');
script.src='https://sclub.jd.com/comment/productPageComments.action?callback=callback&productId=1321337&score=0&sortType=5&page='+index+'&pageSize=10&isShadowSku=0&rid=0&fold=1';
document.body.appendChild(script);
};
next.οnclick=function(){
list.innerHTML='';
index++;
indexs++;
box.innerHTML='第<span>'+indexs+'</span>页'
var script=document.createElement('script');
script.src='https://sclub.jd.com/comment/productPageComments.action?callback=callback&productId=1321337&score=0&sortType=5&page='+index+'&pageSize=10&isShadowSku=0&rid=0&fold=1';
document.body.appendChild(script);
};
</script>
*{
margin: 0;
padding: 0;
}
ul{
list-style: none;
}
#box{
/*width: 30px;*/
color: skyblue;
font-size: 14px;
/*height: 40px;*/
border: 1px solid #87CEEB;
display: inline-block;
}
</style>
</head>
<body>
<button id="btn">查看评论</button>
<button id="next">下一页</button>
<div id="box">第<span>0</span>页</div>
<ul id="list">
<!--<li>从什么都没有的地方 到什么都没有的地方</li>-->
</ul>
</body>
<script>
var btn=document.querySelector('#btn');
var list=document.querySelector('#list');
var next=document.querySelector('#next');
var box=document.querySelector('#box');
var index=0;
var indexs=1;
function callback(data){
data.comments.forEach(function(v){
// console.log(v);
var newli=document.createElement('li');
newli.innerHTML=v.content;
list.appendChild(newli);
});
}
btn.οnclick=function(){
box.innerHTML='';
// index++;
var script=document.createElement('script');
script.src='https://sclub.jd.com/comment/productPageComments.action?callback=callback&productId=1321337&score=0&sortType=5&page='+index+'&pageSize=10&isShadowSku=0&rid=0&fold=1';
document.body.appendChild(script);
};
next.οnclick=function(){
list.innerHTML='';
index++;
indexs++;
box.innerHTML='第<span>'+indexs+'</span>页'
var script=document.createElement('script');
script.src='https://sclub.jd.com/comment/productPageComments.action?callback=callback&productId=1321337&score=0&sortType=5&page='+index+'&pageSize=10&isShadowSku=0&rid=0&fold=1';
document.body.appendChild(script);
};
</script>