window.onload = function()
{
var sizechange = 25;
var i = 1;
var obj1 = document.getElementById('fontstyle1');
var obj2 = document.getElementById('fontstyle2');
var obj3 = document.getElementById('fontstyle3');
var obj4 = document.getElementById('fontstyle4');
var startsize = obj1.style.fontSize;
StyleChange();
function StyleChange()
{
obj1.style.color = 'rgb('+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+')';
obj2.style.color = 'rgb('+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+')';
obj3.style.color = 'rgb('+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+')';
obj4.style.color = 'rgb('+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+')';
switch(i)
{
case 1:
{
obj4.style.fontSize = startsize + 'px'
obj1.style.fontSize = sizechange + 'px';
i++;
break;
}
case 2:
{
obj1.style.fontSize = startsize + 'px';
obj2.style.fontSize = sizechange + 'px';
i++;
break;
}
case 3:
{
obj2.style.fontSize = startsize + 'px'
obj3.style.fontSize = sizechange + 'px';
i++
break;
}
case 4:
{
obj3.style.fontSize = startsize + 'px'
obj4.style.fontSize = sizechange + 'px';
i++;
break;
}
}
if(i == 5)
{
i = 1;
}
setInterval(StyleChange,1000);
}
};
//-->
</script>
{
var sizechange = 25;
var i = 1;
var obj1 = document.getElementById('fontstyle1');
var obj2 = document.getElementById('fontstyle2');
var obj3 = document.getElementById('fontstyle3');
var obj4 = document.getElementById('fontstyle4');
var startsize = obj1.style.fontSize;
StyleChange();
function StyleChange()
{
obj1.style.color = 'rgb('+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+')';
obj2.style.color = 'rgb('+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+')';
obj3.style.color = 'rgb('+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+')';
obj4.style.color = 'rgb('+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+','+Math.round(Math.random()*255)+')';
switch(i)
{
case 1:
{
obj4.style.fontSize = startsize + 'px'
obj1.style.fontSize = sizechange + 'px';
i++;
break;
}
case 2:
{
obj1.style.fontSize = startsize + 'px';
obj2.style.fontSize = sizechange + 'px';
i++;
break;
}
case 3:
{
obj2.style.fontSize = startsize + 'px'
obj3.style.fontSize = sizechange + 'px';
i++
break;
}
case 4:
{
obj3.style.fontSize = startsize + 'px'
obj4.style.fontSize = sizechange + 'px';
i++;
break;
}
}
if(i == 5)
{
i = 1;
}
setInterval(StyleChange,1000);
}
};
//-->
</script>
希望知道的能够指教一下!谢谢了!