知道波浪吧,下面就实现非falsh的javascript波浪文字特效 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br /> <html xmlns="http://www.w3.org/1999/xhtml"> <br /> <head> <br /> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <br /> <title>javascript实现飘动波浪字效果</title> <br /> </head> <br /> <br /> <body> <br /> <script language="JavaScript1.2"> <br /> <br /> //configure message <br /> message="欢迎光临 诺豆网 https://yangjunwei.com" <br /> //animate text in NS6? (0 will turn it off) <br /> ns6switch=1 <br /> <br /> var ns6=document.getElementById&&!document.all <br /> mes=new Array(); <br /> mes[0]=-1; <br /> mes[1]=-4; <br /> mes[2]=-7;mes[3]=-10; <br /> mes[4]=-7; <br /> mes[5]=-4; <br /> mes[6]=-1; <br /> num=0; <br /> num2=0; <br /> txt=""; <br /> function jump0(){ <br /> if (ns6&&!ns6switch){ <br /> jump.innerHTML=message <br /> return <br /> } <br /> if(message.length > 6){ <br /> for(i=0; i != message.length;i++){ <br /> txt=txt+"<span style='position:relative;' id='n"+i+"'>"+message.charAt(i)+"</span>"}; <br /> jump.innerHTML=txt; <br /> txt=""; <br /> jump1a() <br /> } <br /> else{ <br /> alert("Your message is to short") <br /> } <br /> } <br /> <br /> function jump1a(){ <br /> nfinal=(document.getElementById)? document.getElementById("n0") : document.all.n0 <br /> nfinal.style.left=-num2; <br /> if(num2 != 9){ <br /> num2=num2+3; <br /> setTimeout("jump1a()",50) <br /> } <br /> else{ <br /> jump1b() <br /> } <br /> } <br /> <br /> function jump1b(){ <br /> nfinal.style.left=-num2; <br /> if(num2 != 0){num2=num2-3; <br /> setTimeout("jump1b()",50) <br /> } <br /> else{ <br /> jump2() <br /> } <br /> } <br /> <br /> function jump2(){ <br /> txt=""; <br /> for(i=0;i != message.length;i++){ <br /> if(i+num > -1 && i+num < 7){ <br /> txt=txt+"<span style='position:relative;top:"+mes[i+num]+"'>"+message.charAt(i)+"</span>" <br /> } <br /> else{txt=txt+"<span>"+message.charAt(i)+"</span>"} <br /> } <br /> jump.innerHTML=txt; <br /> txt=""; <br /> if(num != (-message.length)){ <br /> num--; <br /> setTimeout("jump2()",50)} <br /> else{num=0; <br /> setTimeout("jump0()",50)}} <br /> </script> <br /> <h2><div id="jumpx" style="color:green"></div></h2> <br /> <script> <br /> if (document.all||document.getElementById){ <br /> jump=(document.getElementById)? document.getElementById("jumpx") : document.all.jumpx <br /> jump0() <br /> } <br /> else <br /> document.write(message) <br /> </script> <br /> <div id="jumpx" style="color:green"></div> <br /> </body> <br /> </html>