function displayimg(){
var bodyBgs = []; //图片地址
bodyBgs[0] = "images/01.png";
bodyBgs[1] = "images/02.png";
bodyBgs[2] = "images/03.png";
bodyBgs[3] = "images/04.png";
bodyBgs[4] = "images/05.png";
bodyBgs[5] = "images/06.png";
bodyBgs[6] = "images/07.png";
bodyBgs[7] = "images/08.png";
bodyBgs[8] = "images/09.png";
bodyBgs[9] = "images/10.png";
bodyBgs[10] = "images/11.png";
bodyBgs[11] = "images/12.png";
bodyBgs[12] = "images/13.png";
bodyBgs[13] = "images/14.png";
bodyBgs[14] = "images/15.png";
bodyBgs[15] = "images/16.png";
bodyBgs[16] = "images/17.png";
bodyBgs[17] = "images/18.png";
bodyBgs[18] = "images/19.png";
bodyBgs[19] = "images/20.png";
bodyBgs[20] = "images/21.png";
bodyBgs[21] = "images/22.png";
bodyBgs[22] = "images/23.png";
bodyBgs[23] = "images/24.png";
bodyBgs[23] = "images/25.png";
var randomBgIndex = Math.round( Math.random() * 24 ); //去随机数
var obj= document.getElementById('myarea');
obj.innerHTML = '<img src ="'+bodyBgs[randomBgIndex]+'" />';
}
//输出随机的背景图
// document.write('<style>body{background:url(' + bodyBgs[randomBgIndex] + ') no-repeat 50% 0}</style>');
<!doctype html>
<html>
<head>
<title>这是我的第一个标签!</title>
<script type="text/javascript" src=" js/ce.js "></script>
<script type="text/javascript" src=" test2.js "></script>
</head>
<body style="text-align:center;">
<div >
<p id="myarea"></p>
</div>
<script>
test2();
</script>
<button onclick="displayimg()"> 显示图片 </button>
</body>
</html>