爱易网
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 浏览次数:20174 次
欢迎光临爱易网网页脚本特效中心,点击运行按钮演示特效:
以下是程序代码
脚本说明: 第一步:把如下代码加入<body>区域中 <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/link.gif"; img1 = new Image(); img1.src = "http://www.aiyiweb.com/images/link.gif"; img2 = new Image(); img2.src = "http://www.aiyiweb.com/images/link.gif"; img3 = new Image(); img3.src = "http://www.aiyiweb.com/images/link.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/link.gif"} if (stepx >= 0 && stepy <=0) {ballimage.src="http://www.aiyiweb.com/images/link.gif"} if (stepx <= 0 && stepy >=0) {ballimage.src="http://www.aiyiweb.com/images/link.gif"} if (stepx >= 0 && stepy >=0) {ballimage.src="http://www.aiyiweb.com/images/link.gif"} } if (document.layers) { if (stepx <= 0 && stepy <=0) {document.ball.document.ballimage.src="http://www.aiyiweb.com/images/link.gif"} if (stepx >= 0 && stepy <=0) {document.ball.document.ballimage.src="http://www.aiyiweb.com/images/link.gif"} if (stepx <= 0 && stepy >=0) {document.ball.document.ballimage.src="http://www.aiyiweb.com/images/link.gif"} if (stepx >= 0 && stepy >=0) {document.ball.document.ballimage.src="http://www.aiyiweb.com/images/link.gif"}}} </SCRIPT> <DIV id=ball style="POSITION: absolute; TOP: -50px"><img border=0 name=ballimage src="http://www.aiyiweb.com/images/link.gif" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/></DIV> 第二步:把<body>中的内容改为: <body onload=setValues()> <a href="http://www.aiyiweb.com/js/">欢迎访问爱易网JS特效</a>
上一篇:狡猾的按钮特效
下一篇:21点(黑杰克)
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
英特尔技术高管离任 电视业务或受影响
窗口期:还有哪些互联网公司可能今年IPO?
网络文学竞争白热化 百度多酷文学网上线
盛大游戏走向衰落的根源:免费游戏模式惹的祸
靠价格战赚取资费套餐利润差,虚拟运营商必死无疑
从3G牌照发放看中国4G规划效果
网曝富士康“二连跳” 疑因推静音模式
2018双11阿里云老用户怎么参加拼团活动 老用户拼团方法
京东联席董事长赵国庆上市前夕离职
推荐阅读
更多>
聚美向左,唯品向右,怎能耐得住高跟和红唇的诱惑!
HTC曝出特大丑闻:高管诈骗+商业间谍
美国政府关门可能影响去哪儿等公司IPO
黑莓高管:黑莓能作为家“小众公司”活下来
乐视今日临时停牌 受广电酝酿新规消息影响
诺基亚称不会更名“微软移动” 5月还将发布新品
微信今天大面积崩溃 腾讯:因光缆施工被挖断
中电信国际漫游费下调85% 世界杯上网28元/天
百视通:Xbox One汉化获批 游戏迷欢呼吧
惠普中国转型只是缩影 未来开展不可预期
诺基亚仍是第二大手机商:功用机有利可图
酷派首抓4G时机大丰收,未来份额必降无疑
百度“全网寻人”面前的互联网信息枢纽价值
中兴通讯不打机海战术 将向中高端手机转型
众贷网满月开张 网络金融监管再受质疑
传搜狗估值12亿美元 与360谈判进入白热化
欧洲6万人起诉Facebook隐私侵权
谷歌新技术进入iOS平台:将叫板苹果Siri
Android应用审核乱象:诈骗软件冲上排行榜首
人们为什么总愿尝试新社交网络?