捌玖网络工作室's Archiver

zw2004 发表于 2008-1-21 20:50

网页之奇特的文字变化特效

脚本说明: D&@ |W m~
v,?boBP6EK`6u
第一步:把如下代码加入<body>区域中 ?|!R+wEg|j
<script language="JavaScript">
.LN.D\9^
oPxL ]K~ function nextSize(i,incMethod,textLength)*SB]:`Gh;P-XR
{
-P$dK+X\3W7H if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );GK:r ?Y(mq
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14)))); _},^{tvp7T
}%rQvXw9zs#VY9P
xz"BpI
function sizeCycle(text,method,dis)F1a!IX n0c q
{!y"HeRE0X^&@
        output = "";
\Jg'ihX         for (i = 0; i < text.length; i++)
i D5`fY         {,YE5o2O3bX5jo#d
                size = parseInt(nextSize(i +dis,method,text.length));Bi;l(wRT5X)?
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
)\G-z6D _)X6f         }1R%HL#t;H}S8m
        theDiv.innerHTML = output;
,Q pQ#V8s9[7\ }
;?y(re%w8R&Y$K VcCRL
function doWave(n) :ys/E X%R]cv5T
{   
/DQZ0y/o.^         theText = "JavaScript";@ w{2yH!Z&G3J
        sizeCycle(theText,1,n);,^3tt/z%Oi:]
        if (n > theText.length) {n=0}0kP[,v3s
        setTimeout("doWave(" + (n+1) + ")", 50);S^F/f;Kf {
}?IR!^0Q"s
</script>
e$h%xCLC <div ID="theDiv" align="center">O5YB+HH+z

.m5{JiJ V%O4mM ^ </div>
dnl,LF .Xm.e^N o:a B}4@R b
tF ^kj.S`am
sa E t ?P

4M,F1kM?;qNj0f 第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

页: [1]
【捌玖网络】已经运行:


Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.