这段代码什么意思?
varrand=0;varuseRand=0;images=newArray;images[1]=newImage();images[1].src="剪子.bmp";im...
var rand = 0;var useRand = 0;images = new Array;images[1] = new Image();images[1].src = "剪子.bmp";images[2] = new Image();images[2].src = "石头.bmp";images[3] = new Image();images[3].src = "布.bmp"function Rn(choose){var imgnum = images.length - 1;do {var randnum = Math.random();rand = Math.round((imgnum - 1) * randnum) + 1;} while (rand== useRand);useRand = rand;document.randimg.src = images[useRand].src;} 有空的大哥,每句写下
展开
展开全部
images = new Array;
images[1] = new Image();
images[1].src = "剪子.bmp";
images[2] = new Image();
images[2].src = "石头.bmp";
images[3] = new Image();
images[3].src = "布.bmp"
定义三张图片
function Rn(choose){
var imgnum = images.length - 1;
do {
var randnum = Math.random();
rand = Math.round((imgnum - 1) * randnum) + 1;
}
while (rand== useRand);
useRand = rand;
document.randimg.src = images[useRand].src;
}
产生一个随机数,然后根据该随机数显示图片
说白了就是有‘剪刀,石头,布 三张图片,程序的功能就是随机显示这三张图片’
images[1] = new Image();
images[1].src = "剪子.bmp";
images[2] = new Image();
images[2].src = "石头.bmp";
images[3] = new Image();
images[3].src = "布.bmp"
定义三张图片
function Rn(choose){
var imgnum = images.length - 1;
do {
var randnum = Math.random();
rand = Math.round((imgnum - 1) * randnum) + 1;
}
while (rand== useRand);
useRand = rand;
document.randimg.src = images[useRand].src;
}
产生一个随机数,然后根据该随机数显示图片
说白了就是有‘剪刀,石头,布 三张图片,程序的功能就是随机显示这三张图片’
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询