上代码:
<script>
function randArticle1(){
let as=$(".click-ul").children("li");
url=$(as[Math.floor(Math.random()*as.length)]).children("a").first().attr("href");
if(url==''||url==window.location.href){self.location.href=$("#typelink").attr('href')}else{self.location.href=url}};
</script>
<ul class="click-ul">
[e:loop={'selfinfo',10,0,0,'','newstime DESC'}]
<li>
<em>
<?=$bqno?>
</em>
<a href="<?=$bqr['titleurl']?>">
<?=$bqr['title']?>
</a>
</li>
[/e:loop]
</ul>
分析:
在
[e:loop={'selfinfo',10,0,0,'','newstime DESC'}]
<li>
<em>
<?=$bqno?>
</em>
<a href="<?=$bqr['titleurl']?>">
<?=$bqr['title']?>
</a>
</li>
[/e:loop]
点击按钮后,这个灵动标签循环中随机抽取一篇文章跳转。
参考效果:http://m.zym.78moban.com/article/lizhizuoyouming/131.html