背景: #EDF0F5 #FAFBE6 #FFF2E2 #FDE6E0 #F3FFE1 #DAFAF3 #EAEAEF 默认  
阅读新闻

网页制作特效代码大全(二)

[日期:2005-08-11] 来源:  作者: [字体: ]

   本代码大全摘自本人所拥有的代码大全软件,现免费提供给大家使用,如有错误的地方请多多指教。谢谢!

 2.文字特效类

  摆动式状态栏跑马灯

<script language="Javascript">
<!--
var x = 0
var speed = 120
var text = "古来圣贤皆寂寞,唯有特效留其名!"


var course = 120
var text2 = text

function Scroll() {
window.status = text2.substring(0, text2.length)

if (course < text2.length) {
setTimeout("Scroll2()", speed)
}

else {
text2 = " " + text2

setTimeout("Scroll()", speed);
}
}

function Scroll2() {
window.status = text2.substring(x, text2.length)

if (text2.length - x == text.length) {
text2 = text
x = 0

setTimeout("Scroll()", speed);
}

else {
x++
setTimeout("Scroll2()", speed);
}
}

Scroll()
//-->
</script>

  标题栏上的跑马灯

<SCRIPT LANGUAGE=JAVASCRIPT>
<!--
var msg = "水晶情缘:http://lovehy.126.com";
var speed = 300;
var msgud = " " + msg;
function titleScroll() {
if (msgud.length <msg.length) msgud += " - " + msg;
msgud = msgud.substring(1, msgud.length);
document.title = msgud.substring(0, msg.length);
window.setTimeout("titleScroll()", speed);
}
-->
</SCRIPT>

<!--将你Html文件的<body>改为如下:-->
<BODY onload="window.setTimeout('titleScroll()', 500)">

  表单按钮一闪一闪的

<form mane=laofz>
<input type="text" name="T1" size="27" value=" 你可以利用到表单的各个方面"  id="flashit"><input type="reset" value="重写" name="B2"  id="flashit">
</form>

<script language="JavaScript1.2">
<!--//
if (document.all&&document.all.flashit){
 
var flashelement=document.all.flashit
if (flashelement.length==null)
flashelement[0]=document.all.flashit
 
function changecolor(which){
if (flashelement[which].style.color=='')
flashelement[which].style.color="#008000" //你可以改变颜色
else
flashelement[which].style.color=""
}
 
 
if (flashelement.length==null)
setInterval("changecolor(0)",1000)
else
for (i=0;i<flashelement.length;i++){
var tempvariable='setInterval("changecolor('+i+')",'+'1000)'
eval(tempvariable)
}
 
}
//-->
</script>

  波浪文字

<script language="JavaScript">
function makeArray(n){
    this.length=n
    return this
}

function hexfromdec(num) {
    hex=new makeArray(1);
    var hexstring="";
    var shifthex=16;
    var temp1=num;
    for(x=1; x>=0; x--) {
        hex[x]=Math.round(temp1/shifthex - .5);
        hex[x-1]=temp1 - hex[x] * shifthex;
        temp1=hex[x-1];
        shifthex /= 16;
    }
    for (x=1; x>=0; x--) { hexstring+=getletter(hex[x]); }
    return (hexstring);
}

function getletter(num) {
    if (num < 10) { return num; }
    else {
        if (num == 10) { return "A" }
        if (num == 11) { return "B" }
        if (num == 12) { return "C" }
        if (num == 13) { return "D" }
        if (num == 14) { return "E" }
        if (num == 15) { return "F" }
    }
}

function rainbow(text){
   var color_d1;
   var allstring="";
   for(i=0;i<text.length;i=i+2){
      color_d1=255*Math.sin(i/(text.length/3));
      color_h1=hexfromdec(color_d1);
      allstring+="<FONT COLOR="+color_h1+"ff"+color_h1+">"+text.substring(i,i+2)+"</FONT>";
   }
   return allstring;
}

function sizefont(text){
   var color_d1;
   var allstring="";
   var flag=0;
   for(i=0,j=0;i<text.length;i=i+1){
      if (flag==0) {
          j++;
          if (j>=7) {
             flag=1;}}
      if (flag==1) {
          j=j-1;
          if (j<=0) {
          flag=0; }}
      allstring+="<FONT SIZE="+ j + ">" + text.substring(i,i+1) + "</FONT>";
   }
   return allstring;
}
document.write("<font size=5><CENTER>")
document.write("<BR><BR>")
document.write( sizefont("水晶情缘主页!"))
document.write("</CENTER></font>")
</script>

  彩色渐谈特效字

<script language="JavaScript">
<!-- Hide
function MakeArray(n){
   this.length=n;
   for(var i=1; i<=n; i++) this[i]=i-1;
   return this
}

hex=new MakeArray(16);
hex[11]="A"; hex[12]="B"; hex[13]="C"; hex[14]="D"; hex[15]="E"; hex[16]="F";

function ToHex(x){
   var high=x/16;
   var s=high+"";
   s=s.substring(0,2); 
   high=parseInt(s,10);
   var left=hex[high+1];
   var low=x-high*16;
   s=low+"";
   s=s.substring(0,2);
   low=parseInt(s,10);
   var right=hex[low+1];
   var string=left+""+right;
   return string;
}

function rainbow(text){
   text=text.substring(3,text.length-4);
   color_d1=100;                              
   mul=color_d1/text.length;
   for(i=0;i < text.length;i++){
      color_d1=255*Math.sin(i/(text.length/3)); "255*Math.sin(i/(text.length/3))"
      color_h1=ToHex(color_d1);
      color_d2=mul*i;
      color_h2=ToHex(color_d2);
      document.write("<FONT COLOR='#FF"+color_h1+color_h2+"'>"+text.substring(i,i+1)+'</FONT>');
   }
}
// -->
</script>
<script>{rainbow("-->水晶情缘网页特效是獻給網頁愛好者的禮物<!--");}</script>

  赤焰特效字

<html>
<head>
<div style="width: 350; font-size:15pt; font-family: Arial ; color: red; position: relative; filter: blur(add=1, direction=45, strength=3)">水晶情缘欢迎您!</div>
</head>
</html>

  单击后字线如放烟花


<!--第一步:把如下代码加入<head>区域中-->
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
var ver  = navigator.appVersion;
var dom  = document.getElementById ? 1 : 0;
var ie5  = (ver.indexOf("MSIE 5") > -1 && dom) ? 1 : 0;
var n  = (document.layers);
var ie = (document.all);

var sparksAflyin = 0;
var totalSparks = 0;
var sparksOn = 1;
function initMouseEvents() {
document.onmousedown = mouseDown;
if (n) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
}
function mouseDown(e) {
if (sparksOn) {
var mousex = (n) ? e.pageX : event.x+document.body.scrollLeft;
var mousey = (n) ? e.pageY : event.y+document.body.scrollTop;
if (!sparksAflyin) {
for (var k = 0; k <= 9; k++)
   eval('SHOW("sDiv'+k+'")');
sparksAflyin = 1;
totalSparks = 0;
for(i = 0;i <= 9; i++)
eval('moveTo('+i+',0,'+mousex+','+mousey+')');
      }
   }
}
function moveTo(i,j, mousex, mousey){
if (j < eval('anim_'+i+'_x.length') ){
var tempx = eval('anim_'+i+'_x[j]+mousex');
var tempy = eval('anim_'+i+'_y[j]+mousey');
if (ie) {
if(tempy+30 > (document.body.offsetHeight+document.body.scrollTop))
tempy = document.body.offsetHeight+document.body.scrollTop-30;
if(tempx+30 > (document.body.offsetWidth+document.body.scrollLeft))
tempx = document.body.offsetWidth+document.body.scrollLeft-30;
eval('document.all.sDiv'+i+'.style.left = tempx;');
eval('document.all.sDiv'+i+'.style.top  = tempy;');
}
if (n) {
eval('document.layers.sDiv'+i+'.left = tempx;');
eval('document.layers.sDiv'+i+'.top  = tempy;');
}
j++;
//  timeout: 50 = fireworks speed, larger number = slower speed
    setTimeout("moveTo("+i+","+j+","+mousex+","+mousey+")",50)
}
else {
eval('HIDE("sDiv'+i+'")');
totalSparks++;
}
if (totalSparks == 10) {
sparksAflyin = 0;
totalSparks  = 0;
   }
}
function SHOW(divName){
if (document.all)
eval('document.all.'+divName+'.style.visibility = "visible";');
else if (document.layers)
eval('document.layers["'+divName+'"].visibility = "visible";');
}
function HIDE(divName){
if (document.all)
eval('document.all.'+divName+'.style.visibility = "hidden";');
else if (document.layers)
eval('document.layers["'+divName+'"].visibility = "hide";');
}
anim_0_x=new Array(20,20,10,0,0,0,0,0,0,0,0,0);
anim_0_y=new Array(-20,-40,-60,-80,-60,-40,-20,0,20,40,60,80);
anim_1_x=new Array(20,20,17,36,60,78,90,92,93,98,108,120,133,152,181);
anim_1_y=new Array(-20,-20,-33,-38,-38,-27,-2,25,51,84,113,141,162,212,253);
anim_2_x=new Array(20,20,2,3,4,5,6,7,8,9,10,12,13,15,18);
anim_2_y=new Array(-20,-20,-33,-38,-38,-27,-2,25,51,84,113,141,162,212,253);
anim_3_x=new Array(-20,-20,-2,-1,7,10,18,35,60,102,94,94,93,97,108,111,117,127);
anim_3_y=new Array(-20,-25,-64,-89,-104,-150,-173,-197,-213,-199,-151,-101,-66,-17,27,87,140,189);
anim_4_x=new Array(-20,-20,-10,-39,-30,-69,-64,-138,-154,-200,-181,-209,-191,-207,-203,-213,-202,-221,-211);
anim_4_y=new Array(-20,-20,-28,-51,-79,-100,-135,-154,-193,-183,-149,-134,-89,-60,8,51,107,157,201);
anim_5_x=new Array(-20,-29,-51,-72,-105,-133,-164,-189,-209,-229,-247,-270,-279,-282,-283,-283,-285,-286,-288);
anim_5_y=new Array(-20,-55,-86,-116,-154,-183,-205,-217,-217,-198,-169,-120,-44,-8,40,87,144,190,248);
anim_6_x=new Array(-20,-20,-7,14,44,79,143,186,217,226,234,244,250,259,265,274);
anim_6_y=new Array(-20,-21,-72,-113,-139,-166,-188,-181,-126,-68,-3,54,134,187,215,257);
anim_7_x=new Array(20,20,-3,-9,-13,-27,-33,-44,-54,-66,-77,-95,-107,-136,-150,-160,-164,-168,-171,-172,-172,-176,-175);
anim_7_y=new Array(-20,-26,-43,-63,-89,-116,-145,-169,-201,-222,-240,-253,-254,-245,-220,-195,-160,-124,-81,-53,-26,19,68);
anim_8_x=new Array(-20,20,-35,39,0,45,-1,24,-15,14,-20,35,-18,38,-11,16,49,64,81,93,100,103,109);
anim_8_y=new Array(-20,-20,-32,-42,-62,-76,-89,-107,-132,-147,-173,-180,-192,-209,-236,-193,-119,-73,-24,51,95,130,188);
anim_9_x=new Array(-20,-51,-89,-110,-165,-191,-228,-240,-259,-271,-277,-281,-287);
anim_9_y=new Array(-20,-20,-35,-37,-34,-16,10,47,105,150,189,227,273);
//  End -->
</script>


<!--第二步:把<body>改为-->
<body bgcolor="#fef4d9" OnLoad="initMouseEvents()">

<!--第三步:在<body>区域中加入如下代码-->
<div id="sparks">
<div id="sDiv0" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">水</font></div>
<div id="sDiv1" style="position:absolute; visibility: hidden;"><font face="arial black" color="yellow">晶</font></div>
<div id="sDiv2" style="position:absolute; visibility: hidden;"><font face="arial black" color="blue">情</font></div>
<div id="sDiv3" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">缘</font></div>
<div id="sDiv4" style="position:absolute; visibility: hidden;"><font face="arial black" color="orange">工</font></div>
<div id="sDiv5" style="position:absolute; visibility: hidden;"><font face="arial black" color="white">作</font></div>
<div id="sDiv6" style="position:absolute; visibility: hidden;"><font face="arial black" color="green">室</font></div>
<div id="sDiv7" style="position:absolute; visibility: hidden;"><font face="arial black" color="skyblue">衡</font></div>
<div id="sDiv8" style="position:absolute; visibility: hidden;"><font face="arial black" color="yellow">阳</font></div>
<div id="sDiv9" style="position:absolute; visibility: hidden;"><font face="arial black" color="white">市</font></div>
</div>

  单击时按钮文字变了

<!--在<head>…</head>之间插入:-->

<style type="text/css">
<!--
.over {color:#000000; background: #fcc546}
.down {color:#000000 background: #fcc546; font-style: italic}
-->
</style>

<!--在<body> …</body>之间插入:-->

<input
type="Button"
onMouseOver="this.className='over';"
onMouseOut="this.className='';"
onMouseDown="this.className='down';"
onMouseUp="this.className='over';"
value="按钮也疯狂"
onClick="this.value='我真的好喜欢你!'" name="Button">

  发亮特效字

<html>
<head>
<div style="width: 350; font-size:15pt; font-family: Arial ; color: red; position: relative; filter: glow(color=ffff00, strength=5)">衡阳水晶情缘工作室</div>
</head>
</html>

  跟随鼠标的彩色文字

<STYLE>.spanstyle {
        COLOR: #0066ff; FONT-FAMILY: 宋体; FONT-SIZE: 9pt; FONT-WEIGHT: normal; POSITION: absolute; TOP: -50px; VISIBILITY: visible
}
</STYLE>
<SCRIPT language=javascript>
        var message="该特效使用水晶情缘网页特效专家编辑制作";
        var x,y;
        var step=12;
        var flag=0;
        message=message.split("");
        var xpos=new Array();
        for (i=0;i<=message.length-1;i++) {
                xpos[i]=-50;
        }
        var ypos=new Array();
        for (i=0;i<=message.length-1;i++) {
                ypos[i]=-50;
        }
        function handlerMM(e) {
                x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX+10;
                y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY;
                flag=1;
        }
        function makesnake() {
                if (flag==1 && document.all) {
                            for (i=message.length-1; i>=1; i--) {
                                   xpos[i]=xpos[i-1]+step;
                                ypos[i]=ypos[i-1];
                            }
                        xpos[0]=x+step;
                        ypos[0]=y;
                        for (i=0; i<=message.length-1; i++) {
                                    var thisspan = eval("span"+(i)+".style");
                                    thisspan.posLeft=xpos[i];
                                thisspan.posTop=ypos[i];
                                thisspan.color=Math.random() * 255 * 255 * 255 + Math.random() * 255 * 255 + Math.random() * 255;
                            }
                }
                else if (flag==1 && document.layers) {
                            for (i=message.length-1; i>=1; i--) {
                                   xpos[i]=xpos[i-1]+step;
                                ypos[i]=ypos[i-1];
                            }
                        xpos[0]=x+step;
                        ypos[0]=y;
                        for (i=0; i<message.length-1; i++) {
                                    var thisspan = eval("document.span"+i);
                                    thisspan.left=xpos[i];
                                thisspan.top=ypos[i];
                                thisspan.color=Math.random() * 255 * 255 * 255 + Math.random() * 255 * 255 + Math.random() * 255;
                        }
                }
        }
</SCRIPT>
<SCRIPT language=javascript>
        for (i=0;i<=message.length-1;i++) {
                    document.write("<span id='span"+i+"' class='spanstyle'>");
                document.write(message[i]);
                    document.write("</span>");
        }
        if (document.layers) {
                document.captureEvents(Event.MOUSEMOVE);
        }
        document.onmousemove = handlerMM;
</SCRIPT>
<SCRIPT language=javascript>
        function pageonload() {
                makesnake();
                window.setTimeout("pageonload();", 2);
        }
</SCRIPT>
<body onload=javascript:pageonload()>

  固定的状态栏文字

<body  onmouseover="self.status='水晶情缘[请用Ctrl+D将本站加入收藏夹]';return true">

  哈哈文字

<SCRIPT LANGUAGE="JavaScript">
timeID = 5;
stcnt = 11;
msg = "该特效使用水晶情缘特效专家编辑制作!";
wmsg = new Array(33);
wmsg[0] = msg;
blnk = "                                                               ";
for (i = 1; i < 32; i++) {
b = blnk.substring(0, i);
wmsg[i] = "";
for (j = 0; j < msg.length; j++) wmsg[i] = wmsg[i] + msg.charAt(j) + b;
}
function wiper() {
if (stcnt > -1) str = wmsg[stcnt];
else str = wmsg[0];
if (stcnt-- < -40) stcnt = 31;
status = str;
clearTimeout(timeID);
timeID = setTimeout("wiper()", 150);
}
</script>
<BODY OnLoad="wiper()">

  好酷鼠标字

<SCRIPT language=javascript>
var cx=0;
var cy=0;
var val=0;
function locate()
{        cx=window.event.x;
        cy=window.event.y;
}
document.onmousemove=locate;
function follow(i)
{        var x;
        if(i<4)x=cx-50+i*10;
        else x=cx-25+i*10;
        var y=cy-20+Math.floor(Math.random()*40);
        w=eval("word"+i);
        with(w.style)
        {
        left=x.toString()+"px";
        top=y.toString()+"px";
        }
}
function show(i)
{
        var w=eval("word"+i);
        with(w.style)
        {
        visibility="visible";
        s=parseInt(fontSize);
        if(s>=200)s-=100;
        else if(s>90&&s<=100)
                {
                s-=85;
                clearInterval(val);
                if(i<5)val=setInterval("show("+(i+1)+")",20);
                }
        fontSize=s;
        }
}
function start()
{        for(i=1;i<=5;i++)
        {
        val=setInterval("show(1)",20);
        setInterval("follow("+i+")",100);

        }
}
</SCRIPT>
<SCRIPT language=javascript>
        var word=new Array(5);
word[1]="第一个字";word[2]="第二个字";word[3]="第三个字";word[4]="第四个字";word[5]="第五个字";
        for(i=1;i<=5;i++)
                document.write("<div id='word"+i+"' style='width:20px;height:20px;position:absolute;font-size:1000;visibility:hidden'><font face='Forte' color='#00FF00'>"+word[i]+"</font></div>");start();
        </SCRIPT>

  横向移动显示的跑马灯

<script language="JavaScript">
<!--
var id,pause=0,position=0,revol=9;
function banner() {
var i,k;
var m1=" 你好,感谢你使用理,请多多提议";
var m2=" 感觉好用的话,请向你的朋友推荐,水晶情缘不胜感激!";
var msg=m1+m2;
var speed=10;
document.isnform.banner.value=msg.substring(position,position+160);
if(position++==msg.length) {
if (revol--< 2) return;
position=0;
}
id=setTimeout("banner()",2000/speed);
}
function navigator(isnform) {
durl=(isnform.isnlist.options[isnform.isnlist.selectedIndex].value)
location.href="/durl"
}
// -->
</script>

<!--修改<body>为-->

<body onload="banner()">

<!--将下列原代码加入<body></body>之间你希望跑马灯出现的地方-->
<form method="POST" name="isnform">
<input type="text" size="48" maxlength="256" name="banner">
</form

  会升降的字句

<script language="JavaScript">
<!--
done = 0;
step = 4
function anim(yp,yk)
{
 if(document.layers) document.layers["napis"].top=yp;
  else  document.all["napis"].style.top=yp;
   if(yp>yk) step = -4
  if(yp<60) step = 4
 setTimeout('anim('+(yp+step)+','+yk+')', 35);
}
function start()
{
 if(done) return
 done = 1;
 if(navigator.appName=="Netscape") {
  document.napis.left=innerWidth/2 - 145;
  anim(60,innerHeight - 60)
 }
 else {
  napis.style.left=11;
  anim(60,document.body.offsetHeight - 60)
 }
}
//-->
</script> 

<div id="napis" style="position: absolute;top: -50;
color: #000000;font-family:宋体;font-size:9pt;"><p>
大家好,请给水晶情缘评分,多多提议!</p></div>
<script language="JavaScript">
<!--
setTimeout('start()',10);
//-->
</script>

  会缩小放大的字句

<SCRIPT language=JavaScript>
<!-- Begin
var speed = 20;
var cycledelay = 1000;
var maxsize = 48;

var x = 0;
var y = 0;
var themessage, size;
var esize = "";

function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
var themessage2 = new initArray(
"网页特效专家",
"水晶情缘工作室",
"隆重奉献",
"衡阳 谢云龙",
"谢谢使用",
"敬请指教"
);
if(navigator.appName == "Netscape")
document.write('<layer id="wds"></layer><br>');
if (navigator.appVersion.indexOf("MSIE") != -1)
document.write('<span id="wds"></span><br>');
function upwords(){
themessage = themessage2[y];
if (x < maxsize) {
x++;
setTimeout("upwords()",speed);
}
else setTimeout("downwords()",cycledelay);

if(navigator.appName == "Netscape") {
size = "<font point-size='"+x+"pt'>";
document.wds.document.write(size+"<center>"+themessage+"</center>"+esize);
document.wds.document.close();
}
if (navigator.appVersion.indexOf("MSIE") != -1){
wds.innerHTML = "<center>"+themessage+"</center>";
wds.style.fontSize=x+'px'
}
}
function downwords(){
if (x > 1) {
x--;
setTimeout("downwords()",speed);
}
else {
setTimeout("upwords()",cycledelay);
y++;
if (y > themessage2.length - 1) y = 0;
}
if(navigator.appName == "Netscape") {
size = "<font point-size='"+x+"pt'>";
document.wds.document.write(size+"<center>"+themessage+"</center>"+esize);
document.wds.document.close();
}
if (navigator.appVersion.indexOf("MSIE") != -1){
wds.innerHTML = "<center>"+themessage+"</center>";
wds.style.fontSize=x+'px'
}
}
setTimeout("upwords()",speed);
// End -->
</script>

  会旋转的文本

<SCRIPT language=javascript>
Phrase="水晶情缘特效专家制作"
Balises=""
Taille=40;
Midx=100;
Decal=0.5;
Nb=Phrase.length;
y=-10000;
for (x=0;x<Nb;x++){
Balises=Balises + '<DIV Id=L' + x + ' STYLE="width:3;font-family: Courier New;font-weight:bold;position:absolute;top:40;left:50;z-index:0">' + Phrase.charAt(x) + '</DIV>'
}
document.write (Balises);
Time=window.setInterval("Alors()",10);
Alpha=5;
I_Alpha=0.05;

function Alors(){
Alpha=Alpha-I_Alpha;
for (x=0;x<Nb;x++){
Alpha1=Alpha+Decal*x;
Cosine=Math.cos(Alpha1);
Ob=document.all("L"+x);
Ob.style.posLeft=Midx+100*Math.sin(Alpha1)+50;
Ob.style.zIndex=20*Cosine;
Ob.style.fontSize=Taille+25*Cosine;
Ob.style.color="rgb("+ (27+Cosine*80+50) + ","+ (127+Cosine*80+50) + ",0)";
}
}
</SCRIPT>

  类似FLASH效果的文字


<script language="JavaScript">
function assignArray(text,delay) {
this.text=text
this.delay=delay
}
function createArray() {
//修改下面的渐变颜色代码
fadecolor=new Array("#000000","#333333","#666666","#999999","#CCCCCC","#FFFFFF")//显示的颜色
msg=new Array()
msg[0]=new assignArray("感谢使用特效专家",1000)//修改显示的文字
msg[1]=new assignArray("特效多多任君选择",1000)//修改显示的文字
msg[2]=new assignArray("有空到水晶情缘的网站走走",1000)//修改显示的文字
msg[3]=new assignArray("播放结束",1000)//修改显示的文字
setTimeout("typeIt()", 1000)
}
var msgNo=0
var character=1
var colorNo=0
var fixColor=1
var colorCheck=0
function typeIt() {
var insertHTML=""
if(msgNo <= msg.length-1) {
if(character <= msg[msgNo].text.length || colorCheck < msg[msgNo].text.length) {
colorCheck=0
for(var charCheck=0; charCheck<character; charCheck++,colorNo--,fixColor--){
if(fixColor>5)colorNo=5
if(colorNo==5)colorCheck+=1
insertHTML += '<SPAN style="font-family:Arial Black; font-size:50pt; color:'+fadecolor[colorNo]+'">' + msg
[msgNo].text.substring(charCheck, charCheck+1) + '</SPAN>'
}
if(document.layers) {
document.typeWriter.document.write(insertHTML)
document.typeWriter.document.close()
} else if (document.all) {
document.all.typeWriter.innerHTML = insertHTML
}
setTimeout("typeIt()", 50)
character++
colorNo=character-1
fixColor=character
}
else {
character=1
colorNo=character-1
fixColor=character
setTimeout("typeIt()", msg[msgNo].delay)
msgNo++
}
}
}
</script>


<body bgcolor="#000000" onLoad="createArray()" text="#ffffff">
<div ID="typeWriter" style="position:absolute; left:200; top:10; width:700">

  梦幻的彩色字

<body onload="dotransition()">

<script>
messages = new Array()
messages[0] = "水晶情缘"
messages[1] = "更新更全更方便"
messages[2] = "想交流请到网站"
messages[3] = "http://lovehy.126.com"
mescolor = new Array()
mescolor[0] = "000000"
mescolor[1] = "FF0000"
mescolor[2] = "008800"
mescolor[3] = "0000FF"
messize = new Array()
messize[0] = "12pt"
messize[1] = "12pt"
messize[2] = "12pt"
messize[3] = "12pt"
var i_messages = 0
var timer
function dotransition() {
if (document.all) {
content.filters[0].apply()
content.innerHTML = "<span style='color:"+mescolor[i_messages]+";font-size:"+messize[i_messages]+";filter: revealTrans(Transition=12, Duration=3)'>"+messages[i_messages]+"</span>"
content.filters[0].play()
if (i_messages >= messages.length-1) {i_messages = 0}
else {i_messages++}}
if (document.layers) {document.content.document.write("<span style='color:"+mescolor[i_messages]+"'>"+messages[i_messages]+"</span>")
if (i_messages >= messages.length-1) {i_messages = 0}
else {i_messages++}}
timer = setTimeout("dotransition()",5000) }
</script>

<div id="content" style="filter: revealTrans(Transition=12, Duration=2); height: 30; left: 131; position: absolute; text-align: center; top: 155; width: 500"></div>

<div id="source"
style="COLOR: #aaaaaa; LEFT: 170px; POSITION: absolute; TEXT-ALIGN: center; TOP: 243px; WIDTH: 500px"><font color="#000000">

  投影特效字

<html>
<head>
<div style="width: 350; font-size:15pt; font-family: Arial ; color: red; position: relative; filter: dropshadow(color=000000, offx=3, offy=3, positive=1)">水晶情缘欢迎您!</div>
</head>
</html>

  文本展播特效

<SCRIPT language="JavaScript">

<!--

var thissize=20

var textfont="隶书"


var textcolor= new Array()

textcolor[0]="000000"

textcolor[1]="000000"

textcolor[2]="000000"

textcolor[3]="111111"

textcolor[4]="222222"

textcolor[5]="333333"

textcolor[6]="444444"

textcolor[7]="555555"

textcolor[8]="666666"

textcolor[9]="777777"

textcolor[10]="888888"

textcolor[11]="999999"

textcolor[12]="aaaaaa"

textcolor[13]="bbbbbb"

textcolor[14]="cccccc"

textcolor[15]="dddddd"

textcolor[16]="eeeeee"

textcolor[17]="ffffff"

textcolor[18]="ffffff"


var message = new Array()

message[0]="水晶情缘工作室"

message[1]="http://lovehy.126.com"

message[2]="更多的特效更多的方便"

message[3]="谢谢使用"

i_message=0


var i_strength=0

var i_message=0

var timer


function glowtext() {

if(document.all) {

if (i_strength <=17) {

glowdiv.innerText=message[i_message]

document.all.glowdiv.style.filter="glow(color="+textcolor[i_strength]+", strength=4)"

i_strength++

timer=setTimeout("glowtext()",100)

}

else {

clearTimeout(timer)

setTimeout("deglowtext()",1500)

}

}

}


function deglowtext() {

if(document.all) {

if (i_strength >=0) {

glowdiv.innerText=message[i_message]

document.all.glowdiv.style.filter="glow(color="+textcolor[i_strength]+", strength=4)"

i_strength--

timer=setTimeout("deglowtext()",100)

}

else {

clearTimeout(timer)

i_message++

if (i_message>=message.length) {i_message=0}

i_strength=0

intermezzo()

}

}

}

function intermezzo() {

glowdiv.innerText=""

setTimeout("glowtext()",1000)

}
//-->
</SCRIPT>

<head>
<title></title>
</head>

<body onLoad="glowtext()">
<div id="glowdiv" style="position:absolute;visibility:visible;width:600px;text-align:center; top:185px;left:70px;font-family:隶书;font-size:30pt;color:000000"></div>

  文字跑上跑下走梯子

<SCRIPT LANGUAGE="JavaScript">

msg ="水晶情缘";
align="left";
speed=250;
up=true;
spas=" ";
for (a=0;a<=12;a++) {spas+=" "}
msg=spas+msg+spas;
j=eval(-1);
stop=msg.length;
document.write("<form name='form'><table border=0 cellspacing=0 "
+"cellpadding=0 align="+align+">");
for (i=1;i<=13;i++) {
document.write("<tr><td><input type=text name=\"box"+i+"\" size=1>");
document.write("</td></tr>");
}
document.write("</table></form>");
function scrollIt() {
j++;
with (document.form) {
if ((j+12) <= stop) {
box1.value = msg.charAt(j);
box2.value = msg.charAt(j+1);
box3.value = msg.charAt(j+2);
box4.value = msg.charAt(j+3);
box5.value = msg.charAt(j+4);
box6.value = msg.charAt(j+5);
box7.value = msg.charAt(j+6);
box8.value = msg.charAt(j+7);
box9.value = msg.charAt(j+8);
box10.value = msg.charAt(j+9);
box11.value = msg.charAt(j+10);
box12.value = msg.charAt(j+11);
box13.value = msg.charAt(j+12);
} else {
j=0;
   }
}
setTimeout("scrollIt()",speed);
}
scrollIt();
// End -->
</SCRIPT>

  一个个字从上往下掉

<script language=JavaScript>
  dynamicanimAttr = "dynamicanimation"
  animateElements = new Array()
  currentElement = 0
  speed = 0
  stepsZoom = 8
  stepsWord = 16
  stepsFly = 12
  stepsSpiral = 16
  steps = stepsZoom
  step = 0
  outString = ""
  function dynAnimation()
  { var ms = navigator.appVersion.indexOf("MSIE")
    ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4)
    if(!ie4)
    { if((navigator.appName == "Netscape") &&
         (parseInt(navigator.appVersion.substring(0, 1)) >= 4))
      {  for (index=document.layers.length-1; index >= 0; index--)
        {   layer=document.layers[index]
            if (layer.left==10000)
                layer.left=0}}
      return    }
    for (index=document.all.length-1; index >= document.body.sourceIndex; index--)
    { el = document.all[index]
      animation = el.getAttribute(dynamicanimAttr, false)
      if(null != animation)
      { if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")
        { ih = el.innerHTML
          outString = ""
          i1 = 0
          iend = ih.length
          while(true)
          { i2 = startWord(ih, i1)
            if(i2 == -1)
              i2 = iend
            outWord(ih, i1, i2, false, "")
            if(i2 == iend)
              break
            i1 = i2
            i2 = endWord(ih, i1)
            if(i2 == -1)
              i2 = iend
            outWord(ih, i1, i2, true, animation)
            if(i2 == iend)
              break
            i1 = i2}
          document.all[index].innerHTML = outString
          document.all[index].style.posLeft = 0
          document.all[index].setAttribute(dynamicanimAttr, null)}
        if(animation == "zoomIn" || animation == "zoomOut")
        { ih = el.innerHTML
          outString = "<SPAN " + dynamicanimAttr + "=\"" + animation + "\" style=\"position: relative; left: 10000;\">"
          outString += ih
          outString += "</SPAN>"
          document.all[index].innerHTML = outString
          document.all[index].style.posLeft = 0
          document.all[index].setAttribute(dynamicanimAttr, null) }}}
    i = 0
    for (index=document.body.sourceIndex; index < document.all.length; index++)
    { el = document.all[index]
      animation = el.getAttribute(dynamicanimAttr, false)
      if (null != animation)
      { if(animation == "flyLeft")
        { el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
          el.style.posTop = 0}
        else if(animation == "flyRight")
        { el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
          el.style.posTop = 0}
        else if(animation == "flyTop" || animation == "dropWord")
        { el.style.posLeft = 0
          el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight}
        else if(animation == "flyBottom")
        { el.style.posLeft = 0
          el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight}
        else if(animation == "flyTopLeft")
        { el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
          el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight}
        else if(animation == "flyTopRight" || animation == "flyTopRightWord")
        { el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
          el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight}
        else if(animation == "flyBottomLeft")
        { el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
          el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight}
        else if(animation == "flyBottomRight" || animation == "flyBottomRightWord")
        { el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
          el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight}        else if(animation == "spiral")
        { el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
          el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight}
        else if(animation == "zoomIn")
        { el.style.posLeft = 10000
          el.style.posTop = 0}
        else if(animation == "zoomOut")
        { el.style.posLeft = 10000
          el.style.posTop = 0}
        else
        { el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
          el.style.posTop = 0}
        el.initLeft = el.style.posLeft
        el.initTop = el.style.posTop
        animateElements[i++] = el}}
    window.setTimeout("animate();", speed)}
  function offsetLeft(el)
  {   x = el.offsetLeft
    for (e = el.offsetParent; e; e = e.offsetParent)
      x += e.offsetLeft;
    return x}
  function offsetTop(el)
  { y = el.offsetTop
    for (e = el.offsetParent; e; e = e.offsetParent)
      y += e.offsetTop;
    return y}
  function startWord(ih, i)
  { for(tag = false; i < ih.length; i++)
    { c = ih.charAt(i)
      if(c == '<')
        tag = true
      if(!tag)
        return i
      if(c == '>')
        tag = false}
    return -1}
  function endWord(ih, i)
  { nonSpace = false
    space = false
    while(i < ih.length)
    {   c = ih.charAt(i)
      if(c != ' ')
        nonSpace = true
      if(nonSpace && c == ' ')
        space = true
      if(c == '<')
        return i
      if(space && c != ' ')
        return i
      i++}
    return -1}
  function outWord(ih, i1, i2, dyn, anim)
  {  if(dyn)
     outString += "<SPAN " + dynamicanimAttr + "=\"" + anim + "\" style=\"position: relative; left: 10000;\">"
    outString += ih.substring(i1, i2)
    if(dyn)
      outString += "</SPAN>"}
  function animate()
  { el = animateElements[currentElement]
    animation = el.getAttribute(dynamicanimAttr, false)
    step++
    if(animation == "spiral")
    { steps = stepsSpiral
      v = step/steps
      rf = 1.0 - v
      t = v * 2.0*Math.PI
      rx = Math.max(Math.abs(el.initLeft), 200)
      ry = Math.max(Math.abs(el.initTop),  200)
      el.style.posLeft = Math.ceil(-rf*Math.cos(t)*rx)
      el.style.posTop  = Math.ceil(-rf*Math.sin(t)*ry)}
    else if(animation == "zoomIn")
    { steps = stepsZoom
      el.style.fontSize = Math.ceil(50+50*step/steps) + "%"
      el.style.posLeft = 0}
    else if(animation == "zoomOut")
    { steps = stepsZoom
      el.style.fontSize = Math.ceil(100+200*(steps-step)/steps) + "%"
      el.style.posLeft = 0}
    else
    { steps = stepsFly
      if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")

阅读:
录入:admin

推荐 】 【 打印
上一篇:CSS巧用expression来区分只读文本框
下一篇:当鼠标经过时清除文本框默认值
相关新闻      
本文评论       全部评论
发表评论


点评: 字数
姓名:

  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款