爱易网
IT新闻
IT新闻
爱易资讯
网站搭建
云虚拟主机教程
云服务器教程
Apache教程
IIS教程
Nginx教程
网站策划
站长文章
推广教程
淘宝客教程
网页设计
HTML教程
XHTML教程
CSS教程
HTML5教程
CSS3教程
JavaSript基础
JQuery教程
Node.js教程
前端技术
Ajax教程
Js特效
Xml教程
平面设计
页面UI设计
photoshop教程
程序开发
AI人工智能
Asp教程
Php教程
Asp.Net教程
Net Core教程
C#教程
Java教程
Jsp教程
开发技术
微信小程序教程
Uniapp开发教程
微信公众号开发
Andriod教程
IOS教程
DOS教程
Python教程
Docker教程
Windows Container教程
数据库
MSSQL教程
MySQL教程
Redis教程
Access教程
Oracle教程
数据库教程
操作系统
Linux教程
Windows教程
MAC教程
Cisco教程
交换机教程
防火墙教程
搜索
爱易网页
JS特效
撞壁自动变换的图片效果
撞壁自动变换的图片效果
日期:2014-05-18 浏览次数:20152 次
欢迎光临爱易网网页脚本特效中心,点击运行按钮演示特效:
以下是程序代码
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>爱易网网页特效演示,撞壁自动变换的图片效果</title> </head> <body onLoad="setValues()"> <SCRIPT> var x,y var marginbottom var marginleft=0 var margintop=0 var marginright // 速度,越小越快 var tempo=60 // 单位时间内水平移动的距离 var stepx=20 // 单位时间内上下移动的距离 var stepy=20 var timer // 图象的路径 img0 = new Image(); img0.src = "http://www.aiyiweb.com/images/face/image21.gif"; img1 = new Image(); img1.src = "http://www.aiyiweb.com/images/face/image21.gif"; img2 = new Image(); img2.src = "http://www.aiyiweb.com/images/face/image21.gif"; img3 = new Image(); img3.src = "http://www.aiyiweb.com/images/face/image21.gif"; // 延迟两秒开始运动 function setValues() { var firsttimer= setTimeout("setValues2()",100)} function setValues2() { if (document.all) { marginbottom = document.body.clientHeight-50 marginright = document.body.clientWidth-50 document.all.ball.style.posLeft=randommaker(marginright-30)+30 document.all.ball.style.posTop=10 moveball() } if (document.layers) { marginbottom = window.innerHeight-10 marginright = window.innerWidth-10 document.ball.left=randommaker(marginright-30)+30 document.ball.top=10 moveball() } } function randommaker(range) { rand=Math.floor(range*Math.random()) return rand } function moveball() { checkposition() chooseimage() if (document.all) { document.all.ball.style.posLeft+=stepx document.all.ball.style.posTop+=stepy timer=setTimeout("moveball()",tempo) } if (document.layers) { document.ball.left+=stepx document.ball.top+=stepy timer=setTimeout("moveball()",tempo) } } function checkposition() { if (document.all) { if (document.all.ball.style.posLeft>=marginright) { stepx=stepx*-1 document.all.ball.style.posLeft-=10 } if (document.all.ball.style.posLeft<=marginleft) { stepx=stepx*-1 document.all.ball.style.posLeft+=10 } if (document.all.ball.style.posTop>=marginbottom) { stepy=stepy*-1 document.all.ball.style.posTop-=10 } if (document.all.ball.style.posTop<=margintop) { stepy=stepy*-1 document.all.ball.style.posTop+=10 } } if (document.layers) { if (document.ball.left>=marginright) { stepx=stepx*-1 document.ball.left-=10 } if (document.ball.left<=marginleft) { stepx=stepx*-1 document.ball.left+=10 } if (document.ball.top>=marginbottom) { stepy=stepy*-1 document.ball.top-=10 } if (document.ball.top<=margintop) { stepy=stepy*-1 document.ball.top+=10 } } } function chooseimage() { if (document.all) { if (stepx <= 0 && stepy <=0) {ballimage.src="http://www.aiyiweb.com/images/face/image21.gif"} if (stepx >= 0 && stepy <=0) {ballimage.src="http://www.aiyiweb.com/images/face/image21.gif"} if (stepx <= 0 && stepy >=0) {ballimage.src="http://www.aiyiweb.com/images/face/image21.gif"} if (stepx >= 0 && stepy >=0) {ballimage.src="http://www.aiyiweb.com/images/face/image21.gif"} } if (document.layers) { if (stepx <= 0 && stepy <=0) {document.ball.document.ballimage.src="http://www.aiyiweb.com/images/face/image21.gif"} if (stepx >= 0 && stepy <=0) {document.ball.document.ballimage.src="http://www.aiyiweb.com/images/face/image21.gif"} if (stepx <= 0 && stepy >=0) {document.ball.document.ballimage.src="http://www.aiyiweb.com/images/face/image21.gif"} if (stepx >= 0 && stepy >=0) {document.ball.document.ballimage.src="http://www.aiyiweb.com/images/face/image21.gif"}}} </SCRIPT> <DIV id=ball style="POSITION: absolute; TOP: -50px"><img border=0 name=ballimage src="http://www.aiyiweb.com/images/face/image21.gif" onload="return im
上一篇:狡猾的按钮特效
下一篇:跟随鼠标的二张图片
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
迅雷高管解读财报:收购快盘可快速融入小米
做大电影,阿里控股公司在港成立影业集团
“世界杯+618”集体磨刀的本质是绑架全民
568倍PE,“长跑者”亚马逊的高估值之谜
看,网络文学今日之繁盛;忆,纯真去哪了?
继续涨:微博IPO第二交易日 收盘大涨11.71%
去看看外面的世界吧!别窝里斗了,中国在线旅游商们
亚马逊第三方平台真的卖盗版书?
国美痛批网购七宗罪 用短暂盈利输了未来
推荐阅读
更多>
AMD Q1净亏1.46亿美元 转战SOC拥抱ARM求变
中电信国际漫游费下调85% 世界杯上网28元/天
独立工具APP:为亿级用户的商业化而愁
微软很“捉急”:补贴Win8 重加末尾按钮
支付宝被曝严重破绽 隐私平安再受质疑
Skype周年:与微软联姻到底有没有未来?
金山毒霸安全中心: XP退役后首个高危漏洞来了
唯品会荣登“最贵中概股”的欢喜与哀愁
永不磨灭的九大尖端编程语言
聚美向左,唯品向右,怎能耐得住高跟和红唇的诱惑!
阿里巴巴IPO难掩的四个现实问题:天猫销售额成谜、淘宝拖后腿、营收迅猛其他不行和投资者未必买账
Docker Desktop 4.11 发布:支持虚拟桌面、Mac 权限更改和新扩展
200美元英特尔Android笔记本行将到来
英特尔IDF峰会启示:释放移动互联的信号
网易云音乐能否为丁磊拿到移动互联网门票?
马云自称在美国曾被绑票
微信今天大面积崩溃 腾讯:因光缆施工被挖断
称产品遭诋毁 奇虎再诉百度
迪信通神秘免费服务揭谜底:充电宝免费带回家
微软大幅调整Bing在华策略:从高大上到接地气