Вот какой у меня получился код:
HTML код:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script language="JavaScript">
var DHTML = (document.getElementById || document.all || document.layers);
function getObj(name)
{
if (document.getElementById)
{
this.obj = document.getElementById(name);
this.style = document.getElementById(name).style;
}
else if (document.all)
{
this.obj = document.all[name];
this.style = document.all[name].style;
}
else if (document.layers)
{
this.obj = document.layers[name];
this.style = document.layers[name];
}
}
function hide(x)
{
x.style.visibility='hidden';
}
function show(x)
{
x.style.visibility='visible';
}
function init(div)
{
if (!DHTML) return;
var x = new getObj(div);
return x;
}
var flag=0;
function rolling(div1,div2)
{
if(!flag)
{
hide(div1);
show(div2);
flag=1;
}
else
{
hide(div2);
show(div1);
flag=0;
}
setTimeout("rolling(div1,div2)",1000);
}
</script>
</head>
<body>
<div id='layer1' style="visibility:visible;position: absolute;top:15;left:15;">LALALALA<br>FIRST DIV</div>
<div id='layer2' style="visibility:hidden;position: absolute;top:15;left:15;">TUTUTUTU<br>SECOND DIV</div>
<script language="JavaScript">
var div1=init('layer1');
var div2=init('layer2');
setTimeout("rolling(div1,div2)",2000);
</script>
</body>
</html>