Re: [問題] [js] 內嵌別的網站圖片

看板Ajax作者 (MAI舞)時間15年前 (2009/06/04 00:55), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
※ 引述《chph (愁痕飄絮)》之銘言: : ※ 引述《kevintwo (MAI舞)》之銘言: : : 本來想說內嵌氣象局網頁裡的衛星雲圖到網頁裡 : : 於是去了中央氣象局的網頁查看,但發現它是用圖片表示的 : : 利用javascript 產生動態感 : : 而想問的問題是,要怎麼做到內嵌呢? : : 我看它的js內容是動態在改變的 : : 如:http://www.cwb.gov.tw/V6/js/s1p_val.js -----(2) : : 直接link 好像不行的樣子,因為js寫的圖檔位置是相對路徑? : : 麻煩各位大大給予提示指點了 謝謝~ : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" : "" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> : <html xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml"> : <head> : <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> : <title>PTT</title> : <style type="text/css"> : #satellite_image_container {background-color:#eee; border:1px solid #aaa; : padding:15px; width:400px; height:430px;} : </style> : </head> : <body> : <div id="satellite_image_container"> : <img class="rotator" /> : </div> : <script type="text/javascript" : src="" rel="nofollow">http://www.cwb.gov.tw/V6/js/s1p_val.js"> </script> : <script type="text/javascript" > : var Rotator = function() { : var data = window.s1p_val; : var img_ctr = document.getElementById('satellite_image_container'); : var img = img_ctr.getElementsByTagName('img')[0]; : var play_order = 0; : var self = this; : this.init = function() { : setInterval("self.update()", 1000); : }; : this.update = function() { : img.src = 'http://www.cwb.gov.tw' + s1p_val[play_order][1]; : play_order = (play_order + 1) % data.length; : }; : this.init(); : }(); : </script> : </body> : </html> 根據上面,我把code 改成了 http://maiitri.twbbs.org/test.php 想做到顯示兩個圖片,但是好像不行,不知是哪想錯了? 再麻煩各位大大了<(_ _)> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.95.110
文章代碼(AID): #1A9ghtDA (Ajax)
文章代碼(AID): #1A9ghtDA (Ajax)