日期:2014-05-16 浏览次数:20364 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>玫瑰从天缓缓而降</title> </head> <body> <img alt="玫瑰" id="rose" src="http://gb.cri.cn/mmsource/images/2007/03/26/ec070326000055.jpg" onload="startdown()" style="position:absolute;top:-500px;" /> <div style="height:2000px;"></div> <script type="text/javascript" > var timer; var y = -500,x=500; var rose = document.getElementById("rose"); function startdown() { timer = window.setInterval("down()",40); } function down() { y++; x += Math.floor(Math.random() * 7) - 3; rose.style.top = y + "px"; rose.style.left = x + "px"; if(y>2000){window.clearInterval(timer);}; } </script> </body> </html>
------解决方案--------------------
用的着自己写吗?去网上搜个地址 贴到你页面不就可以了