第一个是"新年快乐>"
http://blog.csdn.net/zswang/archive/2009/12/31/5114552.aspx
第二个是光点闪闪
http://blog.csdn.net/zswang/archive/2009/12/24/5068237.aspx
同学生日
我把上面2个都改了一下
合并了
研究了很久的代码
终于懂了一点点皮毛
但是后面光点闪闪没效果
界面不闪。
谁帮忙看看啊
代码中我会注明转载的
请大家放心
我修改后的代码
我把js放在了html里面代码过长
分了2楼
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>生日快乐~</title>
<meta http-equiv=Content-Type content="text/html;charset=gb2312">
<script type="text/javascript">
var fontarr=new Array();
var sd=1;
var js=1;
var time=null;
var fontPosition1=new Array(
"160-37","170-47","175-60",
"140-79","156-79","172-79",
"188-79","179-92","168-105","158-118","148-131","139-144",
"168-116","168-131","168-146","168-161","168-176","168-192","168-207",
"180-124","185-136",
"210-75","210-91",
"210-107","226-107","242-107","258-107","274-107",
"210-59","226-59","242-59","258-59","274-59",
"274-75","274-91",
"232-117","232-133","229-149","223-165","216-181","209-197","202-213",
"252-117", "252-133", "252-149", "252-165","252-181","252-197","260-210",
"276-210","292-210","292-196",
"336-53","352-53","368-53","384-53","400-53","416-53","432-53","448-53",
"344-133","360-133","376-133","392-133","408-133","424-133","440-133",
"328-213","344-213","360-213","376-213","392-213","408-213","424-213","440-213","456-213",
"392-69","392-85","392-101","392-117","392-133","392-149","392-165","392-181","392-197",
"620-72","604-72","588-72","572-72","556-72","540-72",
"620-40","604-40","588-40","572-40","556-40","540-40",
"620-104","604-104","588-104","572-104","556-104","540-104",
"524-40","524-56","524-72","524-88","524-104",
"620-40","620-56","620-72","620-88","620-104",
"500-133","500-149","500-165","500-181","500-197","500-213",
"548-133","548-149","548-165","548-181","548-197","548-213",
"516-133","532-133",
"516-213","532-213",
"516-173","532-173",
"596-133","596-149","596-165","596-181","596-197","596-213",
"644-133","644-149","644-165","644-181","644-197","644-213",
"612-133","628-133",
"612-213","628-213",
"612-173","628-173",
"62-367","57-383","52-399","48-415",
"126-352","126-368","126-384","126-400","126-416","126-432","126-448","126-464","126-480","126-496",
"62-512", "78-512","94-512","110-512","126-512","142-512","158-512","174-512","190-512",
"78-448","94-448","110-448","126-448","142-448","158-448","174-448",
"62-392", "78-392","94-392","110-392","126-392","142-392","158-392","174-392","190-392",
"247-353","247-369","247-385","247-401","247-417","247-433","247-449","247-465","247-481","247-497","247-513",
"263-353","279-353","297-353","313-353","329-353","345-353",
"361-353","361-369","361-385","361-401","361-417","361-433","361-449","361-465","361-481","361-497","361-513",
"263-433","279-433","297-433","313-433","329-433","345-433",
"263-513","279-513","297-513","313-513","329-513","345-513",
"433-347","433-363","432-380","432-398","432-411","432-430","432-444","432-460","432-478","432-494","432-510","411-389","409-406","404-423","446-389","456-404",
"473-381","488-381","504-381","518-381","533-381","547-381","557-399","557-419","459-439","476-440","491-440","509-440","524-440","539-440","556-440","570-440","510-350","511-366",
"511-399","510-419","504-457","519-456","497-472","489-489","475-502","458-517","526-472","539-489","555-504","570-520","624-362","640-363","654-362","670-361","686-360","701-358",
"716-357","731-356","746-356","623-379","620-395","616-411","614-428","628-428","644-428","660-428","674-428","689-428","705-428","720-428","734-428","749-428","764-428",
"689-397","689-412","687-445","687-462","687-477","686-493","684-510","668-515","651-516","639-463","627-479","615-492","599-508","728-460","741-474","755-489","769-506"
);
http://blog.csdn.net/zswang/archive/2009/12/31/5114552.aspx
第二个是光点闪闪
http://blog.csdn.net/zswang/archive/2009/12/24/5068237.aspx
同学生日
我把上面2个都改了一下
合并了
研究了很久的代码
终于懂了一点点皮毛
但是后面光点闪闪没效果
界面不闪。
谁帮忙看看啊
代码中我会注明转载的
请大家放心
我修改后的代码
我把js放在了html里面代码过长
分了2楼
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>生日快乐~</title>
<meta http-equiv=Content-Type content="text/html;charset=gb2312">
<script type="text/javascript">
var fontarr=new Array();
var sd=1;
var js=1;
var time=null;
var fontPosition1=new Array(
"160-37","170-47","175-60",
"140-79","156-79","172-79",
"188-79","179-92","168-105","158-118","148-131","139-144",
"168-116","168-131","168-146","168-161","168-176","168-192","168-207",
"180-124","185-136",
"210-75","210-91",
"210-107","226-107","242-107","258-107","274-107",
"210-59","226-59","242-59","258-59","274-59",
"274-75","274-91",
"232-117","232-133","229-149","223-165","216-181","209-197","202-213",
"252-117", "252-133", "252-149", "252-165","252-181","252-197","260-210",
"276-210","292-210","292-196",
"336-53","352-53","368-53","384-53","400-53","416-53","432-53","448-53",
"344-133","360-133","376-133","392-133","408-133","424-133","440-133",
"328-213","344-213","360-213","376-213","392-213","408-213","424-213","440-213","456-213",
"392-69","392-85","392-101","392-117","392-133","392-149","392-165","392-181","392-197",
"620-72","604-72","588-72","572-72","556-72","540-72",
"620-40","604-40","588-40","572-40","556-40","540-40",
"620-104","604-104","588-104","572-104","556-104","540-104",
"524-40","524-56","524-72","524-88","524-104",
"620-40","620-56","620-72","620-88","620-104",
"500-133","500-149","500-165","500-181","500-197","500-213",
"548-133","548-149","548-165","548-181","548-197","548-213",
"516-133","532-133",
"516-213","532-213",
"516-173","532-173",
"596-133","596-149","596-165","596-181","596-197","596-213",
"644-133","644-149","644-165","644-181","644-197","644-213",
"612-133","628-133",
"612-213","628-213",
"612-173","628-173",
"62-367","57-383","52-399","48-415",
"126-352","126-368","126-384","126-400","126-416","126-432","126-448","126-464","126-480","126-496",
"62-512", "78-512","94-512","110-512","126-512","142-512","158-512","174-512","190-512",
"78-448","94-448","110-448","126-448","142-448","158-448","174-448",
"62-392", "78-392","94-392","110-392","126-392","142-392","158-392","174-392","190-392",
"247-353","247-369","247-385","247-401","247-417","247-433","247-449","247-465","247-481","247-497","247-513",
"263-353","279-353","297-353","313-353","329-353","345-353",
"361-353","361-369","361-385","361-401","361-417","361-433","361-449","361-465","361-481","361-497","361-513",
"263-433","279-433","297-433","313-433","329-433","345-433",
"263-513","279-513","297-513","313-513","329-513","345-513",
"433-347","433-363","432-380","432-398","432-411","432-430","432-444","432-460","432-478","432-494","432-510","411-389","409-406","404-423","446-389","456-404",
"473-381","488-381","504-381","518-381","533-381","547-381","557-399","557-419","459-439","476-440","491-440","509-440","524-440","539-440","556-440","570-440","510-350","511-366",
"511-399","510-419","504-457","519-456","497-472","489-489","475-502","458-517","526-472","539-489","555-504","570-520","624-362","640-363","654-362","670-361","686-360","701-358",
"716-357","731-356","746-356","623-379","620-395","616-411","614-428","628-428","644-428","660-428","674-428","689-428","705-428","720-428","734-428","749-428","764-428",
"689-397","689-412","687-445","687-462","687-477","686-493","684-510","668-515","651-516","639-463","627-479","615-492","599-508","728-460","741-474","755-489","769-506"
);
解决方案 »
- IE7中嵌入Realplayer不能播放局域网的视频文件?
- JS如何获得浏览器下载文件时的进度?
- 一个简单的javascript问题!在线等!
- ywm是个变量,所以总是报错说document.thisform.ywm不是对象
- 请教这个二级级联菜单下面该怎么写!?up有分了!
- window.location的奇怪问题
- 如果有两个frame,通过什么方法可以用第一个frame中的按钮来控制打印第二个frame中的内容,急,急,急......,大哥们多多帮忙,谢谢了。
- 请问每隔一段时间激发的函数是怎么写的
- 帮忙看看这代码什么意思?
- JavaScript获取节点最常见4种方法
- null是数据类型呀,还是一个值呀?undefined本身是值,也是类型
- WIN 2003下使用IE8遇到的问题
function create()
{
document.getElementById("main_div").style.left=(document.body.clientWidth-800)/2+"px";
for(var i=0;i<361;i++)
{
fontarr[i]=document.createElement("div");
fontarr[i].style.position="absolute";
if(i>=0 && i<=45)
{
fontarr[i].style.left="0px";
fontarr[i].style.top="0px";
}
if(i>=46 && i<=63)
{
fontarr[i].style.left="0px";
fontarr[i].style.top="280px";
}
if(i>=64 && i<=110)
{
fontarr[i].style.left="780px";
fontarr[i].style.top="0px";
}
if(i>=111 && i<=148)
{
fontarr[i].style.left="780px";
fontarr[i].style.top="280px";
}
if(i>=149 && i<=187)
{
fontarr[i].style.left="0px";
fontarr[i].style.top="300px";
}
if(i>=188 && i<=228)
{
fontarr[i].style.left="0px";
fontarr[i].style.top="580px";
}
if(i>=228 && i<=285)
{
fontarr[i].style.left="780px";
fontarr[i].style.top="300px";
}
if(i>=286 && i<=313)
{
fontarr[i].style.left="780px";
fontarr[i].style.top="580px";
}
fontarr[i].style.width="22px";
fontarr[i].style.height="22px";
fontarr[i].style.overflow="hidden";
//if(navigator.userAgent.toLowerCase().indexOf("ie")!=-1)
// fontarr[i].style.fontSize="20pt";
//else
fontarr[i].style.fontSize="11pt";
fontarr[i].style.color="rgb(255,"+i+","+i+")"
fontarr[i].appendChild(document.createTextNode("●"));
document.getElementById("main_div").appendChild(fontarr[i]);
}
start();
}
function start()
{
time=setTimeout("start()",10);
for(var i=0;i<370;i++)
{
var xy=fontPosition1[i].split("-");
var x=xy[0]-0;
var y=xy[1]-0;
var divleft=fontarr[i].style.left.replace("px","")-0;
var divtop=fontarr[i].style.top.replace("px","")-0;
if(divleft > x)
objMove(fontarr[i],-sd,0);
else
//if(divleft < x) //不让 ● 抖动的话请用if,注释掉else
objMove(fontarr[i],sd,0);
if(divtop > y)
objMove(fontarr[i],0,-sd);
else
//if(divtop < y) //不让 ● 抖动的话请用if,注释掉else
objMove(fontarr[i],0,sd);
}
}
function objMove(divobj,_x,_y)
{
divobj.style.left=divobj.style.left.replace("px","")-0+_x+"px";
divobj.style.top=divobj.style.top.replace("px","")-0+_y+"px";
}
</script>
</head>
<body scroll="auto" onload="create()" onresize="load()" style="background-color:black;">
<form id="form1">
<div id="main_div" style="position:absolute;left:0px;top:20px;width:800px;height:600px;border:black solid 1px">
</div>
</form>
<script text="text/javascript">function hsl2color(hsl) {
if (hsl.h > 360 || hsl.h < 0 || hsl.s > 100 || hsl.s < 0 || hsl.l > 100 || hsl.l < 0)
return "#000000";
var rgb = {r: 0, g: 0, b: 0};
if (hsl.h <= 60) {
rgb.r = 255;
rgb.g = 255 / 60 * hsl.h;
} else if (hsl.h <= 120) {
rgb.r = 255 - (255 / 60) * (hsl.h - 60);
rgb.g = 255;
} else if (hsl.h <= 180) {
rgb.g = 255;
rgb.b = (255 / 60) * (hsl.h - 120);
} else if (hsl.h <= 240) {
rgb.g = 255 - (255 / 60) * (hsl.h - 180);
rgb.b = 255;
} else if (hsl.h <= 300) {
rgb.r = (255 / 60) * (hsl.h - 240);
rgb.b = 255;
} else if (hsl.h <= 360) {
rgb.r = 255;
rgb.b = 255 - (255 / 60) * (hsl.h - 300);
}
var sat = Math.abs((hsl.s - 100) / 100);
rgb.r = rgb.r - (rgb.r - 128) * sat;
rgb.g = rgb.g - (rgb.g - 128) * sat;
rgb.b = rgb.b - (rgb.b - 128) * sat;
var lum = (hsl.l - 50) / 50;
if (lum > 0) {
rgb.r = rgb.r + (255 - rgb.r) * lum;
rgb.g = rgb.g + (255 - rgb.g) * lum;
rgb.b = rgb.b + (255 - rgb.b) * lum;
} else if (lum < 0) {
rgb.r = rgb.r + rgb.r * lum;
rgb.g = rgb.g + rgb.g * lum;
rgb.b = rgb.b + rgb.b * lum;
}
return "#" + ("00000" + (Math.floor(rgb.r) * 256 * 256 +
Math.floor(rgb.g) * 256 + Math.floor(rgb.b)
).toString(16)).replace(/^.*(.{6}$)/g, "$1");
}// 霓虹灯
function Neon(options) {
options = options || {};
this.interval = options.interval || 10; // 变化间隔时间,单位毫秒
this.parent = options.parent || document.body; // 容器
this.bulbCount = options.bulbCount || 100;
this.bulbs = {};
var h = document.body.clientHeight || document.documentElement.clientHeight;
var w = document.body.clientWidth || document.documentElement.clientWidth;
for (var i = 0; i < this.bulbCount; i++) {
this.bulbs[i] = new Bulb({
size: 10 + Math.random() * 10,
pos: {x: Math.random() * w, y: Math.random() * h},
hue: Math.random() * 360,
lightness: Math.random() * 100
});
}
}Neon.prototype = {
replay: function() {
var self = this;
setInterval(function() { self.tick(); }, this.interval);
},
tick: function() {
for (var i = 0; i < this.bulbCount; i++) {
this.bulbs[i].lightness = (this.bulbs[i].lightness + 2) % 100;
this.bulbs[i].doChange();
}
}
}// 灯泡
function Bulb(options) {
options = options || {};
this.parent = options.parent || document.body; // 容器
this.shape = options.shape || "●"; // 形状
this.size = options.size || 12; // 大小
this.pos = options.pos || {}; // 位置
this.hue = options.hue || 100; // 色相
this.saturation = options.saturation || 100; // 饱和度
this.lightness = options.lightness || 50; // 亮度 this.span = document.createElement("span");
this.parent.appendChild(this.span);
this.span.style.position = "absolute";
this.span.style.fontSize = this.size + "px";
this.span.style.left = this.pos.x + "px";
this.span.style.top = this.pos.y + "px";
this.span.innerHTML = this.shape;
this.doChange();
}Bulb.prototype = {
doChange: function() {
this.span.style.color = hsl2color(
{h: this.hue, s: this.saturation, l: this.lightness}
);
}
}new Neon().replay();
</script>
</body>
</html>