如何使用JS实现页面内容随机显示
时间:10-31
作者:
<div id="content"></div>
<script>
var c=["随机内容1","随机内容2","随机内容3","随机内容4"];
window.onload=function(){
document.getElementById("content").inne
<script>
var c=["随机内容1","随机内容2","随机内容3","随机内容4"];
window.onload=function(){
document.getElementById("content").inne
<div id="content"></div>
<script>
var c=["随机内容1","随机内容2","随机内容3","随机内容4"];
window.onload=function(){
document.getElementById("content").innerHTML=c[parseInt(Math.random()*c.length)];
}
</script>
<script>
var c=["随机内容1","随机内容2","随机内容3","随机内容4"];
window.onload=function(){
document.getElementById("content").innerHTML=c[parseInt(Math.random()*c.length)];
}
</script>