我想做一个效果,就是网页里面有个图片,由小变大,再由大变小。我写的代码如下:
<script>
function get1(x)
{x--;
document.images[0].width=x
var obj2=setTimeout(get1,5);
if(x==100)
{clearTimeout(obj2)}
}function get()
{var m=document.images[0].width;
m++;
document.images[0].width=m;
var obj1=setTimeout(get,5);if(m==200)
{clearTimeout(obj1)};
get1(m);}</script>
<style type="text/css">
img{position:absolute;
left:0;
top:0;}
</style>
</head><body onload="get()">
<img src="51.jpg" width="100px" />
</body>
</html>我不知道哪里 写错了 请各位大大们教教我~~谢谢了!
<script>
function get1(x)
{x--;
document.images[0].width=x
var obj2=setTimeout(get1,5);
if(x==100)
{clearTimeout(obj2)}
}function get()
{var m=document.images[0].width;
m++;
document.images[0].width=m;
var obj1=setTimeout(get,5);if(m==200)
{clearTimeout(obj1)};
get1(m);}</script>
<style type="text/css">
img{position:absolute;
left:0;
top:0;}
</style>
</head><body onload="get()">
<img src="51.jpg" width="100px" />
</body>
</html>我不知道哪里 写错了 请各位大大们教教我~~谢谢了!
function get1()
{
var x=document.images[0].width;
x--;
document.images[0].width=x ;
var obj2=setTimeout(get1,5);
if(x==100)
{clearTimeout(obj2)}
}
function get()
{
var m=document.images[0].width;
m++;
document.images[0].width=m;
var obj1=setTimeout(get,5); if(m==200)
{clearTimeout(obj1);
get1();
}} </script>
<script>
function get1(x)
{
x--;
document.images[0].width=x;
if(x==100)
setTimeout("get("+x+")",5);
else
setTimeout("get1("+x+")",5);
} function get(m)
{
if(m==null)
m=document.images[0].width;
m++;
document.images[0].width=m; if(m==200)
setTimeout("get1("+m+")",5);
else
setTimeout("get("+m+")",5);
}
</script>
<style type="text/css">
img{position:absolute;
left:0;
top:0;}
</style>
</head> <body onload="get()">
<img src="51.jpg" width="100px" />
</body>
</html>