| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6157 人关注过本帖
标题:无聊找了点网页特效代码!!
取消只看楼主 加入收藏
oヤ偽妳變壞
Rank: 2
等 级:新手上路
威 望:4
帖 子:2251
专家分:0
注 册:2006-3-19
收藏
得分:0 

文字从右弹出


脚本说明:
把如下代码加入<head>区域中

<script language="JavaScript">
var MESSAGE = " 欢迎来到细溪驿站,请多提意见。谢谢! "
var POSITION = 150
var DELAY = 10
var scroll = new statusMessageObject()
function statusMessageObject(p,d) {
this.msg = MESSAGE
this.out = " "
this.pos = POSITION
this.delay = DELAY
this.i = 0
this.reset = clearMessage}
function clearMessage() {
this.pos = POSITION}
function scroller() {
for (scroll.i = 0; scroll.i < scroll.pos; scroll.i++) {
scroll.out += " "}
if (scroll.pos >= 0)
scroll.out += scroll.msg
else scroll.out = scroll.msg.substring(-scroll.pos,scroll.msg.length)
window.status = scroll.out
scroll.out = " "
scroll.pos--
if (scroll.pos < -(scroll.msg.length)) {
scroll.reset()}
setTimeout ('scroller()',scroll.delay)}
function snapIn(jumpSpaces,position) {
var msg = scroll.msg
var out = ""
for (var i=0; i<position; i++)
{out += msg.charAt(i)}
for (i=1;i<jumpSpaces;i++)
{out += " "}
out += msg.charAt(position)
window.status = out
if (jumpSpaces <= 1) {
position++
if (msg.charAt(position) == ' ')
{position++ }
jumpSpaces = 100-position
} else if (jumpSpaces > 3)
{jumpSpaces *= .75}
else
{jumpSpaces--}
if (position != msg.length) {
var cmd = "snapIn(" + jumpSpaces + "," + position + ")";
scrollID = window.setTimeout(cmd,scroll.delay);
} else { window.status=""
jumpSpaces=0
position=0
cmd = "snapIn(" + jumpSpaces + "," + position + ")";
scrollID = window.setTimeout(cmd,scroll.delay);
return false }
return true}
snapIn(100,0);
</script>

2006-04-25 12:52
oヤ偽妳變壞
Rank: 2
等 级:新手上路
威 望:4
帖 子:2251
专家分:0
注 册:2006-3-19
收藏
得分:0 

标题栏里多段标题文字的替换显现
要完成此效果把如下代码加入到<head>区域中

<SCRIPT LANGUAGE="JavaScript">
var message = new Array();
message[0] = "Welcome To You...";
message[1] = "细溪驿站...";
message[2] = "jojoo@jojoo.net...";


var reps = 1;
var speed = 275;// Set the overall typing speed (larger number = slower action).
var hold = 4 // set the length of time to display the whole phrase before retyping (larger number = longer)

var p = message.length;
var q = 0;
var r = 0;
var C = 0;
var mC = 0;
var s = 0;
var sT = null;

if (reps < 1) {
reps = 1;
}
function setMessage() {
typing = message[mC];
q = typing.length;
r = q + hold;
typeMessage();
}
function typeMessage() {
if (s > r) {
s = 0;
}
if (s > q) {
document.title = '|- '+ typing +' - - -';
}
else {
document.title = '|- '+ typing.substr(0,s)+' - - -';
}
if (C < (r * reps)) {
sT = setTimeout("typeMessage()", speed);
C++;
s++;
}
else {
C = 0;
s = 0;
mC++;
if(mC > p - 1) {mC = 0;}
sT = null;
setMessage();
}
}
setMessage();
</script>

2006-04-25 12:53
oヤ偽妳變壞
Rank: 2
等 级:新手上路
威 望:4
帖 子:2251
专家分:0
注 册:2006-3-19
收藏
得分:0 

状态栏显示链接内容特效

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var data = "0123456789";
var done = 1;
function statusIn(text) {
decrypt(text, 2, 1);
}

function statusOut() {
self.status = '';
done = 1;
}

function decrypt(text, max, delay) {
if (done) {
done = 0;
decrypt_helper(text, max, delay, 0, max);
}
}
function decrypt_helper(text, runs_left, delay, charvar, max) {
if (!done) {
runs_left = runs_left - 1;
var status = text.substring(0, charvar);
for (var current_char = charvar; current_char < text.length; current_char++) {
status += data.charAt(Math.round(Math.random()*data.length));
}
window.status = status;
var rerun = "decrypt_helper('" + text + "'," + runs_left + "," + delay + "," + charvar + "," + max + ");"
var new_char = charvar + 1;
var next_char = "decrypt_helper('" + text + "'," + max + "," + delay + "," + new_char + "," + max + ");"
if(runs_left > 0) {
setTimeout(rerun, delay);
}
else {
if (charvar < text.length) {
setTimeout(next_char, Math.round(delay*(charvar+3)/(charvar+1)));
}
else {
done = 1;
}
}
}
}
// End -->
</script>

<center>
<a href="http://www.jojoo.net/"
onMouseOver="statusIn('细溪驿站. [http://www.jojoo.net/]');return true;"
onMouseOut="statusOut();">JavaScript Fairyland</a>
</center>

2006-04-25 12:55
oヤ偽妳變壞
Rank: 2
等 级:新手上路
威 望:4
帖 子:2251
专家分:0
注 册:2006-3-19
收藏
得分:0 

背景向下移动的脚本

<SCRIPT language=VBScript>
dim c,numgc
c=-100000
numgc=document.body.sourceIndex
sub SF
c=c+2
Document.all(numgc).style.BackgroundPosition="0 "&c
id=SetTimeOut("SF",64,"VBScript")
end sub
SF
</SCRIPT>

<body background=back.jpg onLoad="ob(),setNum(),setInterval('timer()',100);setInterval('runClock()',100)">

2006-04-25 12:56
oヤ偽妳變壞
Rank: 2
等 级:新手上路
威 望:4
帖 子:2251
专家分:0
注 册:2006-3-19
收藏
得分:0 

背景不停变化的脚本

<SCRIPT language=javascript><!--
var pos=10;function initArray(){this.length=initArray.arguments.length;
for(var i=0;i<this.length;i++){this[i]=initArray.arguments[i];}}
var col=new initArray("4b","5b","8b","8b");
col[0]="yellow";col[1]="coral";col[2]="orange";col[3]="red";
col[4]="greenyellow";col[5]="lime";col[6]="turquoise";col[7]="coral";
col[8]="blueviolet";col[9]="violet";
function chgCol(){pos++;if(pos<0||pos>9){pos=0;}document.bgColor=col[pos];
setTimeout("chgCol()",3000);/*这里你可以改变时间间隔.*/
}
var yourwords="不断变化背景色彩";var buffer1=" ";
var buffer2=" ";
var message1=buffer1+yourwords+buffer2;
var dir="left";var speed=150;function pingpong(){
if(dir=="left")
{message2=message1.substring(2,message1.length)+" ";
window.status=message2;setTimeout("pingpong();",speed);message1=message2;
if(message1.substring(0,1)=="*")dir="right";}
else{message2=" "+message1.substring(0,message1.length-2);
window.status=message2;setTimeout("pingpong();",speed);
message1=message2;if(message1.substring(message1.length-1,message1.length)=="*")dir="left";}}//
-->
</SCRIPT>
<body bgColor=#ffffff onload="chgCol(); pingpong();">




2006-04-25 12:56
oヤ偽妳變壞
Rank: 2
等 级:新手上路
威 望:4
帖 子:2251
专家分:0
注 册:2006-3-19
收藏
得分:0 
明天继续!!!!!
2006-04-25 12:57
oヤ偽妳變壞
Rank: 2
等 级:新手上路
威 望:4
帖 子:2251
专家分:0
注 册:2006-3-19
收藏
得分:0 
各位看了还是顶一下哈!
2006-04-25 12:57
oヤ偽妳變壞
Rank: 2
等 级:新手上路
威 望:4
帖 子:2251
专家分:0
注 册:2006-3-19
收藏
得分:0 

继续那天的!!

2006-04-28 18:43
oヤ偽妳變壞
Rank: 2
等 级:新手上路
威 望:4
帖 子:2251
专家分:0
注 册:2006-3-19
收藏
得分:0 

title栏变化弹出


脚本说明:
把如下代码加入<head>区域中
<script language="javascript">
<!-- Hide me
var index_count = 0;
var title_string = "欢迎光临javascript世界精彩集锦,这里有许多javascript源程序,是您设计主页的最好帮手! ";
var title_length = title_string.length;
var cmon;
var kill_length = 0;
function loopTheScroll()
{
scrollTheTitle();
if(kill_length > title_length)
{
clearTimeout(cmon);
}

kill_length++;
cmon = setTimeout("loopTheScroll();",100)
}

function scrollTheTitle()
{
var doc_title = title_string.substring((title_length - index_count - 1),title_length);
document.title = doc_title;

index_count++;
}


loopTheScroll();

//-->
</script>

2006-04-28 18:44
oヤ偽妳變壞
Rank: 2
等 级:新手上路
威 望:4
帖 子:2251
专家分:0
注 册:2006-3-19
收藏
得分:0 

一个很COOL的东东!!(用鼠标左右上下键来控制的QQ)


<script>
var smapdata = new Array(
"11111111111111111111",
"10000000000000000001",
"10010000000000000001",
"10010022000000000001",
"11010000000000000301",
"10010111110000003001",
"10000001300000000301",
"11111001000010000001",
"10000001000000000001",
"10000001000000111001",
"10000000000000000001",
"10000000011110000001",
"10021200000000000001",
"10000000000000000001",
"11111111111111111111"
)

var mapData =new Array(15);
var spriteX=0;
spriteY=0;
var winbox=0;

function readMap(){ //重建地图信息便于程序使用。
for(var i=0;i<15;i++){
mapData[i]=new Array(20);
for(var j=0;j<20;j++){
mapData[i][j]=smapdata[i].substr(j,1);
}
}
}

function CreateMap(){ //用dom来创建地图。
var x=30;
var y=30;
var cbox=0;
for (var i=0;i<15;i++){
for (var j=0;j<20;j++){
var oe=document.createElement("div");
oe.id="box"+i+"_"+j; //设定id规则以便后面程序访问。
oe.className="map"+mapData[i][j];
oe.style.pixelLeft=x;
oe.style.pixelTop=y;
gameArea.appendChild(oe);
x+=19;
}
y+=19;
x=30;
}
}

function move(dir){
var dx=0;
var dy=0;
if(dir=="Left") dx=-1;
if(dir=="Right") dx=1;
if(dir=="Up") dy=-1;
if(dir=="Down") dy=1;
if(mapData[spriteY+dy][spriteX+dx]=="1" ) return;
if(mapData[spriteY+dy][spriteX+dx]=="2" ) {
if(mapData[spriteY+dy*2][spriteX+dx*2]=="0" || mapData[spriteY+dy*2][spriteX+dx*2]=="3"){
if(mapData[spriteY+dy*2][spriteX+dx*2]=="3"){
mapData[spriteY+dy*2][spriteX+dx*2]="1";
winbox++;
if(winbox==3) win();
}
else mapData[spriteY+dy*2][spriteX+dx*2]="2";
mapData[spriteY+dy][spriteX+dx]="0";
eval("box"+(spriteY+dy)+"_"+(spriteX+dx)).style.backgroundColor='#333333';
eval("box"+(spriteY+dy*2)+"_"+(spriteX+dx*2)).style.backgroundColor='#3333FF';
spriteX+=dx;
spriteY+=dy;
sprite.style.pixelLeft+=dx*19;
sprite.style.pixelTop+=dy*19;
}
}else{
spriteX+=dx;
spriteY+=dy;
sprite.style.pixelLeft+=dx*19;
sprite.style.pixelTop+=dy*19;
}
}

function win(){
alert("OK 胜 利 !!!");
}

function fnKeydown(){
var key=event.keyCode;
switch(key){
case 37:
move("Left");
break;
case 39:
move("Right");
break;
case 38:
move("Up");
break;
case 40:
move("Down");
break;
}
return false;
}

function init(){
readMap();
CreateMap();
sprite.style.pixelLeft=49;
sprite.style.pixelTop=49;
spriteX=1;
spriteY=1;
}

document.onkeydown=fnKeydown;
</script>

<STYLE TYPE="text/css">
.map0{position:absolute;border:1px solid #cococo;width:20;height:20;background-color:#333333}
.map1{position:absolute;border:2px outset #FFFFFF;width:20;height:20;background-color:#999999}
.map2{position:absolute;border:1px solid #4078B0;width:20;height:20;background-color:#3333FF}
.map3{position:absolute;border:0px solid #999999;width:20;height:20;background-color:#006600}
.box{position:absolute;border:1px outset #ffffff;width:20;height:20;background-color:#0000cc}
}
</STYLE>

<body bgColor=#333333 onload="init()">
<div id=gameArea></div>
<div id="sprite" style="position:absolute"><img src="pic/0-2.gif" height=20 width=20></div>
</body>

2006-04-28 18:45
快速回复:无聊找了点网页特效代码!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040355 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved