Re: [問題] 請問可連結的隨機圖片該如何製作

看板Web_Design作者 (惡魔黨)時間19年前 (2004/10/07 03:06), 編輯推噓1(101)
留言2則, 1人參與, 最新討論串1/6 (看更多)
※ 引述《monlex (行善積德終有好報)》之銘言: : 多虧mdfh 我已經順利做出隨機圖片的效果 : 並且也利用<a>標籤包住<script>標籤的方式加入了超連結 : 但是這樣一來不論出現哪一張圖片 : 都只能連結到同一個網址 : 是我做錯了嗎? : 我把我的程式波上來 拜託請幫我指正 謝謝 : <a href="http://www.nccu.edu.tw" target="_blank"> : <script language="JavaScript"> : <!-- : tips = new Array(); : tips[0] = "Picture01.jpg"; : tips[1] = "Picture02.jpg"; : tips[2] = "Picture03.jpg"; : index = Math.floor(Math.random() * tips.length); : document.write("<IMG SRC=" + tips[index] + " border=0></img>"); : // --> : </script></a> 沒有做錯 因為超連結只有設定一個 ._. 如果是多個超連結,就要用回剛剛A兄寫的程式: (沒看清楚你問的...sorry @_@) <script language="JavaScript"> <!-- tips = new Array(3); tips[0] = "<a href='http://www.ntu.edu.tw'><img src='ntu.gif'></img>"; tips[1] = "<a href='http://www.nccu.edu.tw'><img src='nccu.gif'></img>"; tips[2] = "<a href='http://www.ncu.edu.tw'><img src='ncu.gif'></img>"; index = Math.floor(Math.random() * tips.length); document.write(" + tips[index] + "); // --> </script> <img> 那裡應該是 <img src='ntu.gif' border='0'></img> 因為螢幕不夠寬 如果還有其他的 " 都要變成 ' -- 我的個人板: P_MDFH Hyper Digi'Studio telnet://hds.twbbs.org -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.200.212

61.229.19.62 10/07, , 1F
我這次真的成功了!!
61.229.19.62 10/07, 1F

61.229.19.62 10/07, , 2F
真是太感謝mdfh兄了 再拜叩首 Orz
61.229.19.62 10/07, 2F
文章代碼(AID): #11P48QJn (Web_Design)
討論串 (同標題文章)
文章代碼(AID): #11P48QJn (Web_Design)