当前位置:首页> 正文

刷新页面即随机变换显示的图片JS代码

刷新页面即随机变换显示的图片JS代码

刷新页面即随机变换显示的图片JS代码

 

<SCRIPT language=JavaScript><!--
today=new Date();
jran=today.getTime();
function rnd() {
    ia=9301;
    ic=49297;
    im=233280;
    jran = (jran*ia+ic) % im;
    return jran/(im*1.0);
};
function rand(number) {
    return Math.ceil(rnd()*number);
};
document.write("<CENTER>");
for(i=1;i<=1;i++) {
    myNum=(rand(8)); //改成你要随机显示的图片数;
if(myNum == 1) document.write("<img src='/images/m01.webp'>"); 
if(myNum == 2) document.write("<img src='/images/m02.webp'>"); //图片路径,可用http://
if(myNum == 3) document.write("<img src='/images/m03.webp'>"); 
if(myNum == 4) document.write("<img src='/images/m04.webp'>"); 
if(myNum == 5) document.write("<img src='/images/m05.webp'>");
if(myNum == 6) document.write("<img src='/images/m06.webp'>"); 
if(myNum == 7) document.write("<img src='/images/m07.webp'>"); 
if(myNum == 8) document.write("<img src='/images/m08.webp'>");  
    else {
document.write();
}
};
document.write("</CENTER>");
// --></SCRIPT>

 

展开全文阅读

相关内容