java脚本即用特效源码从入门到精通帮你渡过难关
源代码在线查看: rainbow-text.txt
1. 把数据复制到你的Html文件的Head标记下
2. 把数据复制到你的Html文件的Body标记下 -->
function createHexArray(n) {
this.length = n;
for (var i = 1; i this[i] = i - 1;
this[11] = "A";
this[12] = "B";
this[13] = "C";
this[14] = "D";
this[15] = "E";
this[16] = "F";
return this;
}
hx = new createHexArray(16);
function convertToHex(x) {
if (x < 17) x = 16;
var high = x / 16;
var s = high+"";
s = s.substring(0, 2);
high = parseInt(s, 10);
var left = hx[high + 1];
var low = x - high * 16;
if (low < 1) low = 1;
s = low + "";
s = s.substring(0, 2);
low = parseInt(s, 10);
var right = hx[low + 1];
var string = left + "" + right;
return string;
}
function makeRainbow(text) {
text = text.substring(0, text.length);
color_d1 = 255;
mul = color_d1 / text.length;
for(var i = 0; i < text.length; i++) {
color_d1 = 255*Math.sin(i / (text.length / 3));
color_h1 = convertToHex(color_d1);
color_d2 = mul * i;
color_h2 = convertToHex(color_d2);
k = text.length;
j = k - i;
if (j < 0) j = 0;
color_d3 = mul * j;
color_h3 = convertToHex(color_d3);
document.write("" + text.substring(i, i + 1) + "");
}
}
// End -->
makeRainbow("谢谢您购买这本书!");
// -->
|
相关资源 |
|
-
java脚本即用特效源码从入门到精通帮你渡过难关
-
从入门到精通交给你网页设计的基本技能!绝对经典
-
Delphi 7 从入门到精通随书源码
-
Delphi7从入门到精通及随书源码,学习和开发DELPHI7的好东东,自然要和大家分享!
-
《COM与COM+从入门到精通》一书配套光盘中的源码。
-
eclipse 从入门到精通的源码,有了这个如果学会的话,可以毫无质疑的说我会SWT编程.包括:thread,button,canvas,combol,filllayout,griddata,prog
-
asp.net1从入门到精通,包括源码及数据库,基础及通用实例
-
ASP.NET从入门到精通(源码及数据库)
|