网页背景自动更换···怎么没其作用·
<body onload="randompic()" >
<script language="javascript">
function randompic()
{
var i=Math.floor(Math.random()*5);
var scr="";
switch(i)
{
case 0:
src="0.jpg"
break;
case 1:
src="1.jpg"
break;
case 2:
src="2.jpg"
break;
case 3:
src="3.jpg"
break;
case 4:
src="4.jpg"
break;
}
document.body.background="src";
window.setTimeout("randompic()",1000);
}
</script>
------解决方案--------------------<body onload="randompic()" >
<script language="javascript">
function randompic()
{
var i=Math.floor(Math.random()*5);
var scr="";
switch(i)
{
case 0:
src="http://avatar.csdn.net/2/9/5/1_mengxix.jpg"
break;
case 1:
src="http://poster.weather.com.cn/p_files/base/101010100.jpg"
break;
case 2:
src="http://i.weather.com.cn/images/cn/news/2013/11/14/5B637353C6EB823E19C7B55588FF2A4C.jpg"
break;
case 3:
src="3.jpg"
break;
case 4:
src="4.jpg"
break;
}
document.body.background=
src;
window.setTimeout("randompic()",1000);
}
</script>