爱易网
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 浏览次数:21766 次
欢迎光临爱易网网页脚本特效中心,点击运行按钮演示特效:
以下是程序代码
要完成此效果需要两个步骤 第一步:把如下代码加入到<head>区域中 <SCRIPT LANGUAGE="JavaScript"> <!-- color=new Array("0","3","6","9","C","F"); speed=250; document.bgColor="FFFFFF"; bg=new Array("FFFFFF","FFFFFF","FFFFFF"); function begin() { document.form.col1.value=" X "; document.form.col2.value=" X "; document.form.col3.value=" X "; i=0; roll(speed); } function roll(speedB) //轮子滚动 { if (document.form.col1.value==" X ") { document.form.c1.value=document.form.b1.value; document.form.b1.value=document.form.a1.value; document.form.a1.value= color[Math.round(Math.random()*10)%6]+ color[Math.round(Math.random()*10)%6]; //利用随机函数产生轮子上的颜色值 } if (document.form.col2.value==" X ") { document.form.c2.value=document.form.b2.value; document.form.b2.value=document.form.a2.value; document.form.a2.value= color[Math.round(Math.random()*10)%6]+ color[Math.round(Math.random()*10)%6]; } if (document.form.col3.value==" X ") { document.form.c3.value=document.form.b3.value; document.form.b3.value=document.form.a3.value; document.form.a3.value= color[Math.round(Math.random()*10)%6]+ color[Math.round(Math.random()*10)%6]; } setTimeout("roll("+speedB+")",speedB); } function stop(col) //轮子停止滚动 { if (col==1) {document.form.col1.value=" ";i++;} if (col==2) {document.form.col2.value=" ";i++;} if (col==3) {document.form.col3.value=" ";i++;} if (i==3) { bg[0]=document.form.a1.value+ document.form.a2.value+ document.form.a3.value; bg[1]=document.form.b1.value+ document.form.b2.value+ document.form.b3.value; bg[2]=document.form.c1.value+ document.form.c2.value+ document.form.c3.value; speedB=500000;roll(speedB); } } function view(letter) //颜色预览 { document.bgColor=bg[letter]; document.form.color.value="#"+bg[letter]; } --> </script> 第二步:把如下代码加入到<body>区域中 <form name="form"> <table cellpadding=2 border=1 align="center"> <tr><td align=center> <input type=text name="a1" size=3 onFocus="this.blur()" value=" "> <input type=text name="a2" size=3 onFocus="this.blur()" value=" "> <input type=text name="a3" size=3 onFocus="this.blur()" value=" "> <input type=button onClick="view(0)" value="预览"><br> <input type=text name="b1" size=3 onFocus="this.blur()" value=" "> <input type=text name="b2" size=3 onFocus="this.blur()" value=" "> <input type=text name="b3" size=3 onFocus="this.blur()" value=" "> <input type=button onClick="view(1)" value="预览"><br> <input type=text name="c1" size=3 onFocus="this.blur()" value=" "> <input type=text name="c2" size=3 onFocus="this.blur()" value=" "> <input type=text name="c3" size=3 onFocus="this.blur()" value=" "> <input type=button onClick="view(2)" value="预览"><br> <input type=button onClick="stop(1)" value=" X " name="col1"> <input type=button onClick="stop(2)" value=" X " name="col2"> <input type=button onClick="stop(3)" value=" X " name="col3"> </td> <td valign=middle align=center> <input type=button onClick="begin()&quo
上一篇:狡猾的按钮特效
下一篇:用按钮来实现背景色的闪烁
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
科技巨匠体验谷歌眼镜:戴上了就不想摘上去
团购网站存活率仅18.6% 剩余缺乏千家
O2O成"唐僧肉":百度糯米抢食第一口令阿里腾讯颤抖
解读苹果收购Beats背后动机:库克在想什么?
联想架构调整后:Think品牌或推智能手机
Google要求硬件厂商捆绑预装应用的协议曝光
广电地方营业厅的一句“罚停”,暴露出了他们的本质
罗永浩工匠形象坍塌,锤子产能再跳水逃离用户超两成
韩国研制无线充电系统:一次可充40部手机
推荐阅读
更多>
迅雷欲3300万美元收购金山快盘 预计9月完成
中兴引进黑莓三个核心团队
Skype周年:与微软联姻到底有没有未来?
雅安地震 绝不宽恕应用人们爱心的骗子!
喜大普奔:2016年国内乘客有望在飞机上使用手机
摩托罗拉中国区将再裁员 助力公司变身
二代 iPad Air将配备2GB内存?为同屏多任务做准备
网友爆料称微软雇水军宣传主机Xbox One
戴尔新CEO名单曝光:惠普甲骨文高管在列
看病也能用支付宝了 马云的又一盘大棋
史玉柱谈创业:5大建议 失败的教训最真实
“宽带中国”计划已正式上升为国家战略
华为、小米和联想在中国手机市场上演“三国杀”
公信力消失:马航事件社交媒体传播之痛
人们为什么总愿尝试新社交网络?
传搜狗估值12亿美元 与360谈判进入白热化
诺基亚依托规模效应 猛攻国际市场空白
小米盗版有理激怒乐视:提500部盗播证据猛追打
苹果iWatch或使用量产液态金属 将取代玻璃
搜狐与奇虎360或结盟对抗BAT