作者pinewolf (消失在秋天的秘密)
看板Web_Design
标题请问乱数输出结果 对应图片在输出要怎麽写??
时间Sun Nov 6 16:46:10 2005
我想将图片 配合对应乱数输出
如果乱数跑出 1的话 就在1的前面显示xxx.jpg
跑出2的话 就跑xxxx.jpg
请问要怎麽写呢??
以下是我的原始码
<html>
<head>
<title>Runes抽牌程式</title>
</head>
<body style="color: rgb(0, 0, 0); background-color: rgb(200, 255, 204);"
alink="#000099" link="#000099" vlink="#990099">
<tr>
<td style="vertical-align: top;">
<b><font color="#ff0000" size="6">
<p align="center">
<script language="javascript">
var out1 = new Array(9);
var runes = new Array(25);
runes[0] = " Fehu ";runes[1] = " Uruz ";runes[2] = "Thurisaz";runes[3] =
" Ansuz ";runes[4] = " Raidho ";runes[5] = " Kenaz ";
runes[6] = " Gebo ";runes[7] = " Wunjo ";runes[8] = " Hagalaz";runes[9] =
" Nauthiz";runes[10] = " Isa ";runes[11] = " Jera ";
runes[12] = " Eihwaz ";runes[13] = " Perthro";runes[14] = " Algiz
";runes[15] = " Sowilo ";runes[16] = " Tiwaz ";runes[17] = " Berkano";
runes[18] = " Ehwaz ";runes[19] = " Mannaz ";runes[20] = " Laguz
";runes[21] = " Ingwaz ";runes[22] = " Dagaz ";runes[23] = " Othala ";
runes[24] = " Blank ";
var flag=true;
while (flag)
{
flag=false;
for (i=0;i<9;i++)
{
out1[i] = runes[Math.floor(Math.random() * runes.length)];
}
for(i=0;i<9;i++)
{
for(j=0;j<i;j++)
{
if(out1[j]==out1[i])
{
flag=true;
break;
}
}
}
}
document.write(out1[0]+"  "+out1[6]+"<br><br>  "+out1[1]+" "+out1[2]+" "+out1[3]+" "+out1[4]+"<br><br>    "+out1[5]+"  "+out1[7]);
</script></font></b>
</html>
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.160.39.212
※ 编辑: pinewolf 来自: 218.160.39.212 (11/06 16:49)
※ 编辑: pinewolf 来自: 220.135.105.20 (11/07 22:34)