作者kevintwo (MAI舞)
看板Ajax
标题Re: [问题] [js] 内嵌别的网站图片
时间Thu Jun 4 00:55:18 2009
※ 引述《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"
: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
: <html xmlns="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="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