随机显示广告图片

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>随机显示广告图片</title>
</head>
<body>

<script>
    advertisement = new Array(4);
    advertisement[0] = '<img src="http://www.lanrentuku.com/down/js/images/12498863530.jpg" />';
    advertisement[1] = '<img src="http://www.lanrentuku.com/down/js/images/12498863531.jpg" />';
    advertisement[2] = '<img src="http://www.lanrentuku.com/down/js/images/12498863532.jpg" />';
    advertisement[3] = '<img src="http://www.lanrentuku.com/down/js/images/12498863533.jpg" />';
    var index = Math.floor(Math.random() * advertisement.length);
    document.write(advertisement[index]);
</script>

<p>刷新下看看效果吧~</p>
    
</body>
</html>
原文地址:https://www.cnblogs.com/lqcdsns/p/5937787.html