读书人

动态改变frame里的src展示不同的内容

发布时间: 2012-11-09 10:18:48 作者: rapoo

动态改变frame里的src,显示不同的内容
大家好,我有一个html页面,他是由2个frame组成的,他们组成一个大屏(2个显示器合并那么大)

现在我需要实现的是,每隔10秒左边的frame的内容动态变化,也就是src里的htm页面动态变化,

比如说我有popScreenLeft.htm,popScreenLeft1.htm,popScreenLeft3.htm 3个页面,让他们每轮流显示,每个显示10秒。

请问能否实现。

谢谢!



<frameset rows="*" cols="1215,*" framespacing="0" frameborder="yes" border="0">
<frame src="popScreenLeft.htm" name="leftFrame" scrolling="NO" >
<frame src="popScreenRight_new.htm" name="mainFrame" scrolling="NO">
</frameset>

[解决办法]

HTML code
<frameset rows="*" cols="1215,*" framespacing="0" frameborder="yes" border="0"> <frame src="popScreenLeft.htm" name="leftFrame" scrolling="NO" >   <frame src="popScreenRight_new.htm" name="mainFrame" scrolling="NO"> </frameset><script>var locations=["popScreenLeft.htm","popScreenLeft1.htm","popScreenLeft3.htm"];var index=0;var TIMER;function changeperten(){   leftFrame.location.herf=locations[index++];   TIMER=setTimeout(changeperten,10000);}window.onload=function(){   TIMER=setTimeout(changeperten,10000);}</script>
[解决办法]
改一下10秒
HTML code
<script language="javascript">var n = 0;var urls = ['popScreenLeft.htm','popScreenLeft1.htm','popScreenLeft3.htm'];function doit(){  leftFrame.location.href = urls[n] + "?" + escape(new Date());  n++;  if(n==3) n=0;}window.onload=function(){    setInterval("doit()", 10000)}</script><frameset rows="*" cols="1215,*" framespacing="0" frameborder="yes" border="0"> <frame src="popScreenLeft.htm" name="leftFrame" scrolling="NO" >   <frame src="popScreenRight_new.htm" name="mainFrame" scrolling="NO"> </frameset> 

读书人网 >JavaScript

热点推荐