JS翻版效果
<DIV id="roll_layer" style="OVERFLOW: hidden; WIDTH: 368px; HEIGHT: 135px"></DIV>
<DIV id="big_news" style="DISPLAY: none">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://www.comdns.cn/UserUpPic/2008425192139.jpg"></td>
</tr>
</table>
</div>
<DIV id="big_news" style="DISPLAY: none">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://www.comdns.cn/UserUpPic/2008425184629.jpg"></td>
</tr>
</table>
</div>
<DIV id="big_news" style="DISPLAY: none">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://www.comdns.cn/UserUpPic/2008425185657.jpg"></td>
</tr>
</table>
</div>
<DIV id="big_news" style="DISPLAY: none">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://www.comdns.cn/UserUpPic/2008730151102.jpg"></td>
</tr>
</table>
</div>
<DIV id="big_news" style="DISPLAY: none">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://www.comdns.cn/UserUpPic/2008425190813.jpg"></td>
</tr>
</table>
</div>
<script type="text/javascript">
/*
第一
显示内容层;<DIV id="roll_layer" style="OVERFLOW: hidden; WIDTH: 368px; HEIGHT: 120px"></DIV>
存放内容层:<DIV id="big_news" style="DISPLAY: none">内容</div>
*/
var speed=20;
var offset= 5;
var delay=4500;
var cur = 0;
var roll_interval;
var pasue_timeout;
function roll()
{
var now_pos = roll_layer.scrollTop;
roll_layer.scrollTop+=offset;
if (now_pos==roll_layer.scrollTop)
{
pasue('stop');
}
}
function stop_roll(){
window.clearInterval(roll_interval);
}
function start_roll()
{
roll_layer.scrollTop = 0;
roll_interval = window.setInterval('roll()',speed);
}
function text_switch()
{
roll_layer.innerHTML=big_news[cur].innerHTML;
if (++cur==big_news.length)
{
cur=0;
}
roll_layer.innerHTML+=big_news[cur].innerHTML;
}
function pasue(act)
{
if (act=='stop')
{
stop_roll();
pasue('timeout');
}else if(act=='timeout')
{
pasue_timeout = window.setTimeout("pasue('switch');",delay);
}else if(act=='switch')
{
text_switch();
start_roll();
}
}
function start()
{
text_switch();
cur=0;
pasue("timeout");
}
start();
</script>
浙公网安备 33010602011771号