[問題]請問亂數輸出結果 對應圖片在輸出要怎麼寫??

看板Web_Design作者 (消失在秋天的秘密)時間19年前 (2005/11/06 16:41), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
我想將圖片 配合對應亂數輸出 如果亂數跑出 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]+"&#12288;&#12288;"+out1[6]+"<br><br>&#12288;&#12288;"+out1[1]+"&#12288;"+out1[2]+"&#12288;"+out1[3]+"&#12288;"+out1[4]+"<br><br>&#12288;&#12288&#12288;&#12288;"+out1[5]+"&#12288;&#12288;"+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)
文章代碼(AID): #13RS7Lto (Web_Design)
文章代碼(AID): #13RS7Lto (Web_Design)