找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 78|回复: 3

测试功能,后后

[复制链接]
发表于 2010-1-9 02:18:49 | 显示全部楼层 |阅读模式 IP:江苏扬州
程序代码:

<style>
BODY {FONT-SIZE:9pt;}
TD {FONT-SIZE:9pt; LINE-HEIGHT:11pt;}
input {FONT-SIZE:9pt;}
SELECT {FONT-SIZE:9pt; TEXT-ALIGN:center; WIDTH:100px;}
span {FONT-SIZE:12pt;}
</style>
<script language="JavaScript">
window.onload = function(){
var color_list = new Array();
var hex = new Array(6);
var CurColor;
var CurIndex;
hex[0] = "FF"
hex[1] = "CC"
hex[2] = "99"
hex[3] = "66"
hex[4] = "33"
hex[5] = "00"
for(var x=0;x<6;x++){
  for(var y=0;y<6;y++){
   for(var z=0;z<6;z++){
    CurColor = hex[x] + hex[y] + hex[z];
    CurIndex = color_start.options.length;
    color_start.options[CurIndex] = new Option("",CurColor);
    color_start.options[CurIndex].style.backgroundColor = "#"+ CurColor;
    CurIndex = color_end.options.length;
    color_end.options[CurIndex] = new Option("",CurColor);
    color_end.options[CurIndex].style.backgroundColor = CurColor;
   }
  }
}
}
function Dec2Any(str,num){
if(!/\d+/.test(str)) return NaN;
if(!/\d+/.test(num)) return NaN;
var num=eval(num);
if(num>36 || num<2)  return NaN;
var the_str="0123456789abcdefghijklmnopqrstuvwxyz";
var str=eval(str);
var residue=0;
var result="";
while(true){
  residue=str%num;
  result = the_str.charAt(residue) + result;
  if(str<num) break;
  str=Math.floor(str/num);
}
return(result);
}
function get_color(the_num){
if(the_num > 255) the_num = 255;
if(the_num < 0)   the_num = 0;
var the_color = Dec2Any(the_num,16);
if(the_color.length==1) the_color = "0" + the_color;
return the_color;
}
function build_text(str,C_start,C_end){
var the_len = str.length;
var R_start = eval("0x" + C_start.substr(0,2));
var R_end = eval("0x" + C_end.substr(0,2));
var R_unit = Math.floor((R_start - R_end)/the_len);
var G_start = eval("0x" + C_start.substr(2,2));
var G_end = eval("0x" + C_end.substr(2,2));
var G_unit = Math.floor((G_start - G_end)/the_len);
var B_start = eval("0x" + C_start.substr(4,2));
var B_end = eval("0x" + C_end.substr(4,2));
var B_unit = Math.floor((B_start - B_end)/the_len);
var CurColorStr = "";
var ResultStr = "";
var tmp;
show.value  = "";
for(var i=0;i<the_len;i++){
  CurColorStr = "#";
  CurColorStr += get_color(R_start - i * R_unit);
  CurColorStr += get_color(G_start - i * G_unit);
  CurColorStr += get_color(B_start - i * B_unit);
  ResultStr   += "<font color='"+CurColorStr+"'>"+str.substr(i,1)+"</font>";
  show.value  += "<font color='"+CurColorStr+"'>"+str.substr(i,1)+"</font>\n";
}
return ResultStr;
}
function BuildIt(){
clearInterval(flash_timer);
ShowText.innerHTML = build_text(the_text.value,color_start.value,color_end.value);
if(flash.checked) Flash_text();
}
var flash_timer = null;
var color_list  = null;
function Flash_text(){
var obj_list = ShowText.children;
color_list   = new Array();
for(var i=0;i<obj_list.length;i++){
  color_list[color_list.length] = ShowText.children.color;
}
flash_timer = setInterval("FlashIt()",50);
}
function FlashIt(){
var tmp_arr = new Array();
for(var i=0;i<color_list.length-1;i++){
  tmp_arr[i+1] = color_list;
}
tmp_arr[0] = color_list;
color_list = tmp_arr;
for(var i=0;i<color_list.length;i++){
  ShowText.children.color = color_list;
}
}
</script>
<table>
<tr>
<td colspan="3">显示文字: <input id="the_text" type="text" size="50" value="彩虹文字彩虹文字彩虹文字彩虹文字彩虹文字"></td>
</tr>
<tr>
<td>起始颜色: <select id="color_start" onchange="BuildIt();the_text.focus()"></select></td>
<td>---- </td>
<td>结束颜色: <select id="color_end" onchange="BuildIt();the_text.focus()"></select></td>
</tr>
<tr>
<td colspan="3"><input id="flash" type="checkbox" onclick="this.checked?Flash_text():clearInterval(flash_timer)"><label for="flash">闪烁</label></td>
</tr>
</table>
<span id="ShowText" style></span><br>
<textarea id="show" rows="15" cols="50"></textarea>
发表于 2010-1-9 02:18:53 | 显示全部楼层 IP:江苏扬州
:loveliness: :funk: :(
回复

使用道具 举报

发表于 2010-1-9 02:18:56 | 显示全部楼层 IP:江苏扬州
啥东西来的???
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 07:30 , Processed in 0.280993 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表