图片经过指定时间变化一次

今天访问了硅谷动力网络学院,发现其中下部有一行图片经过指定时间变化一次,实现图片文章的显示,觉得效果不错,打开查看了一下源代码,发现其使用的是刷新的功能,在这里给大家说说。具体代码为:

<table width="748" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
    <td height=95 background="ab28-1.gif" width="23" > </td>
    <td  height=95  align="center" background="ab28-2.gif">
<a href="http://www.enet.com.cn/eschool/inforcenter/A20040410301390.html" target="_blank"><img src="/eschool/images/v2/main1.gif" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/eschool/inforcenter/A20040819335401.html" target="_blank"><img src="/eschool/images/v2/baishi.gif" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/edu/inforcenter/A20041015352615.html" target="_blank"><img src="/eschool/images/v2/5jianwanfu.gif" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/eschool/inforcenter/A20041009350269.html" target="_blank"><img src="/eschool/images/v2/PHOTOSHOPtianse.gif" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/eschool/inforcenter/A20050415408861.html" target="_blank"><img src="/eschool/images/v2/54764567.gif" vspace=8 border=0 class=border_img></a>     </td>
    <td  height=95  background="ab28-3.gif" width="16"></td>
  </tr>
</table>
<script>setTimeout("location.href='rdztt2.html'",10000);</script>

  把上面的代码保存为一个文件为rdztt1.html,然后我们再建立了一个文件rdztt2.html,内容如下:

<table width="748" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
    <td height=95 background="ab28-1.gif" width="23" > </td>
    <td  height=95  align="center" background="ab28-2.gif">
<a href="http://www.enet.com.cn/eschool/inforcenter/A20040825337317.html" target="_blank"><img src="/eschool/images/v2/yingpan.gif" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/eschool/inforcenter/A20041109360306.html" target="_blank"><img src="/eschool/images/v2/9mmnbvc.gif" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/eschool/zhuanti/iis/" target="_blank"><img src="/eschool/images/v2/iisserver.gif" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/edu/inforcenter/A20040811332742.html" target="_blank"><img src="/eschool/images/v2/nianxin.gif" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/eschool/inforcenter/A20040816334318.html" target="_blank"><img src="/eschool/images/v2/psxuejing.gif" vspace=8 border=0 class=border_img></a>     </td>
    <td  height=95  background="ab28-3.gif" width="16"></td>
  </tr>
</table>
<script>setTimeout("location.href='rdztt3.html'",10000);</script>

  然后又建立了一个rdztt3.html,内容如下:

<table width="748" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
    <td height=95 background="ab28-1.gif" width="23" > </td>
    <td  height=95  align="center" background="ab28-2.gif">
<a href="http://www.enet.com.cn/eschool/zhuanti/fireworks/" target="_blank"><img src="/eschool/images/v2/fireworkview.gif" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/eschool/inforcenter/A20041022355087.html" target="_blank"><img src="/eschool/images/v2/6uryeyu.gif" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/eschool/inforcenter/A20050118383106.html" target="_blank"><img src="/eschool/images/v2/tuijianjingmei5.jpg" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/eschool/inforcenter/A20050119383530.html" target="_blank"><img src="/eschool/images/v2/xiugaiwinxpzhi7.jpg" vspace=8 border=0 class=border_img></a>    &nbsp;&nbsp;    <a href="http://www.enet.com.cn/eschool/inforcenter/A20050119383752.html" target="_blank"><img src="/eschool/images/v2/jinchdenggua8.jpg" vspace=8 border=0 class=border_img></a>     </td>
    <td  height=95  background="ab28-3.gif" width="16"></td>
  </tr>
</table>
<script>setTimeout("location.href='rdztt1.html'",10000);</script>

  大家可以注意到上面三个文件中均有如下代码:

<script>setTimeout("location.href='*****.html'",10000);</script>

这就是实现自动刷新的代码,使用了setTimeout()函数设置为每隔10秒钟刷新一次!最后使用iframe标签加到主页中:

<iframe name="titleframe" src='/eschool/includes/gdtup/tu5/rdztt1.html' noresize="Yes"  scrolling="No" frameborder="0" marginheight="0" marginwidth="0" width=750 height=100></iframe>

具体演示效果大家可以看看

http://www.enet.com.cn/eschool/中下部变化的图片

http://www.enet.com.cn/eschool/includes/gdtup/tu5/rdztt1.html实际显示的页面

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值