首页
精品网站
艺术设计
网络学院
信息中心
求职招聘
网站综合
服装网站
编程开发
设计论坛
投稿
我要上榜
设计资源站
平面设计
画册
VI欣赏
包装
CG-插画
搜索
个人网页
Alexa排名
CSS
建站资源
下载专区
JS特效
品牌服装
服装院校
专题欣赏
SEO
图标欣赏
专题
域名注册
虚拟主机
广州网站设计
域名注册
广州网站建设
上海网站建设
虚拟主机
广州网页设计
签名设计
虚拟主机
域名注册
acg王国
ACG玩家
当前位置:
网站综合首页
>>
网页JS特效
>>
文本特效类
>> 网页设计中动态更改字符的颜色特效
网页设计中动态更改字符的颜色特效
网站色彩搭配讲解
跟我探索网站排名的捷径
网页banner设计欣赏
网站装饰图标设计欣赏
设计赛事集合
ACG王国
来源:
中国设计秀
作者:
佚名
点击:
135
加入收藏
发表评论
0
顶一下
关键字:
网页
字符
特效
代码如下,点击运行可查看效果:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Dynamic Update</title> <style type="text/css"> h1 { font:bold 15px/19px Georgia, serif; } p {margin:0;} span#colorselections a { border:2px solid #fff; margin-right:4px; display:block; float:left; } a img { border:1px solid #fff; width:22px; height:22px; } span#colorselections a.on { border:2px solid #d5680d; } p#previewer { margin:26px 0 20px 0; padding:6px; clear:left; font:bold 19px/25px Verdana; border:1px solid #ccc; width:80%; } </style> <script type="text/javascript"> // generic window.onload function function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } // this function inserts the text into the target paragraph tag function updatePreview() { var previewer = document.getElementById('previewer'); var inputtxt = document.getElementById('inputText'); previewer.firstChild.nodeValue=inputtxt.value; } // this function attaches the onkeyup event to the text input function setText() { var inputtxt = document.getElementById("inputText"); inputtxt.onkeyup = function() { updatePreview(); } } addLoadEvent(setText); // this function changes the color of the text function updateTextColor(txtcolor) { var txt = document.getElementById('previewer'); txt.style.color = txtcolor; return false; } // this function helps with the orange border around the 'on' color in the list function clearColorSelections() { var colors = document.getElementById("colorselections"); var choices = colors.getElementsByTagName("a"); for (var i=0;i<choices.length;i++) { choices[i].className=""; } } // this function takes whatever color you've chosen, and passes it to the // updateTextColor function. function setColor() { var colorselection = document.getElementById("colorselections"); var links = colorselection.getElementsByTagName("a"); for ( var i=0; i < links.length; i++) { links[i].onclick = function() { clearColorSelections(); updateTextColor(this.style.backgroundColor); this.className = "on"; return false; } } } addLoadEvent(setColor); </script> </head> <body> <h1>输入字符</h1> <p> <input type="text" id="inputText" name="inputText" value="Sample Text to Type" /> </p> <h1 style="margin-top:16px;">Choose a color</h1> <p> <span id="colorselections"> <a href="#" style="background-color:#000000;" class="on"> <img src="/uploadfile/site/uploadfile/200806/20080621105533600.gif" class="colorbox" alt="Black" /> </a> <a href="#" style="background-color:#003399;" class=""> <img src="/uploadfile/site/uploadfile/200806/20080621105533600.gif" class="colorbox" alt="Light Blue" /> </a> <a href="#" style="background-color:#5E5E5E;" class=""> <img src="/uploadfile/site/uploadfile/200806/20080621105533600.gif" class="colorbox" alt="Medium Gray" /> </a> <a href="#" style="background-color:#00524E;" class=""> <img src="/uploadfile/site/uploadfile/200806/20080621105533600.gif" class="colorbox" alt="Dark Teal" /> </a> <a href="#" style="background-color:#258B86;" class=""> <img src="/uploadfile/site/uploadfile/200806/20080621105533600.gif" class="colorbox" alt="Light Teal" /> </a> <a href="#" style="background-color:#DA7E33;" class=""> <img src="/uploadfile/site/uploadfile/200806/20080621105533600.gif" class="colorbox" alt="Orange" /></a> <a href="#" style="background-color:#198541;" class=""> <img src="/uploadfile/site/uploadfile/200806/20080621105533600.gif" class="colorbox" alt="Green" /> </a> </span> </p> <br clear="all" /> <p id="previewer" style="color:#000000;">Sample Text to Type</p> </body> </html>
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
2008-06-26 00:53:00 出处:
中国设计秀cnwebshow.com
本文引用地址:
http://www.cnwebshow.com/site/html/article_2350.html
热点文章/相关文章
最新文章
·
js特效文本框随文本的长度而增长
·
图片选择images of radio chec...
·
网页设计中动态更改字符的颜色特效
·
网页设计中字体及字体大小的匹...
·
一个精美强大的JS日历代码
·
六种风格时间显示,一定有你喜欢...
·
文字播放完成后页面随即跳转
·
7种JS脚本分页代码 showPages v1.0
·
3个最常用的JS时间特效
·
实时变化的时间特效
艺术设计秀最新图片
美国设计师平面设...
乌克兰平面设计作...
DeLonghi Steam I...
Simi Mahtani 杂志...
多款酒瓶包装设计...
优秀企业画册设计欣赏
推荐文章
·
图片选择images of radio chec...
素材下载
矢量
潮流素材
背景素材
模板
网站地图
|
关于我们
|
联系我们
|
网站建设
|
广告服务
|
版权声明
|
免责声明
|
网站公告
|
友情链接
|
留言
|
旧版入口
Copyright © 2005-2008
中国设计秀_网页设计秀_艺术设计秀_网页设计教程_网站建设作品_平面设计欣赏_包装设计欣赏_品牌网站建设
All Right Reserved.
做最专业的设计服务网站,秀出自我,秀出精彩!
中国设计秀,秀---无处不在!!
交流群:9107036 3848215 8850631
粤ICP备05067046号