打字效果
<div align="center" id="myexample" style="border:5px ridge red; width:650"><h2><span id="fly" style="color:7b007b"></span></h2>
<script>
window.onerror=new Function("return true")
message ='☆总有一个人,会让你心动总有一段往事,会让你感动,总有一个音符,能够触动你的神经,穿透你的内心,慰藉你的灵魂.当眼里漾起忘不掉的从前,我们流泪了…… 在心如锈铁的时代,还有没有一首歌,曾让你感动过? 记忆和我们成长,让我们一起看着它不朽……☆';
distance = 50;
speed = 500;
if (!document.all)
document.write('<h2>'+message+'</h2>')
</script>
<script language="JavaScript1.2">
txt="";num=0;num4=0;flyofle="";flyofwi="";flyofto=""
function stfly(){for(i=0;i != message.length;i++){if(message.charAt(i) != "$"){txt=txt+"<span style='position:relative;visibility:hidden;' id='n"+i+"'>"+message.charAt(i)+"<\/span>"};else{txt=txt+"<br>"}};fly.innerHTML=txt;txt="";flyofle=fly.offsetLeft;flyofwi=fly.offsetWidth;flyofto=fly.offsetTop;fly2b()}
function fly2b(){if(num4 != message.length){if(message.charAt(num4) != "$"){eval("n"+num4+".style.left=flyofle-n"+num4+".offsetLeft+flyofwi/2");eval("n"+num4+".style.top=flyofto-n"+num4+".offsetTop+distance");eval("fly3('n"+num4+"',eval(n"+num4+".style.left.substring(0,n"+num4+".style.left.length-2)),(eval(n"+num4+".style.left.substring(0,n"+num4+".style.left.length-2))/5),eval(n"+num4+".style.top.substring(0,n"+num4+".style.top.length-2)),(eval(n"+num4+".style.top.substring(0,n"+num4+".style.top.length-2))/5))")};num4++;setTimeout("fly2b()",speed)}}
function fly3(target,lef2,num2,top2,num3){if((Math.floor(top2) != 0 && Math.floor(top2) != -1) || (Math.floor(lef2) != 0 && Math.floor(lef2) != -1)){if(eval("'"+lef2+"'").charAt(0) != '-'){lef2=lef2-num2};else{lef2=lef2+(-num2)};if(Math.floor(lef2) != -1){eval(target+".style.visibility='visible';"+target+".style.left=Math.floor(lef2)")};else{eval(target+".style.visibility='visible';"+target+".style.left=Math.floor(lef2+1)")};if(eval("'"+lef2+"'").charAt(0) != '-'){top2=top2-num3};else{top2=top2+(-num3)};if(Math.floor(top2) != -1){eval(target+".style.top=Math.floor(top2)")};else{eval(target+".style.top=Math.floor(top2+1)")};setTimeout("fly3('"+target+"',"+lef2+","+num2+","+top2+","+num3+")",50)}};
stfly()
</script></div><script language="JavaScript1.2">
function flashit(){
if (!document.all)
return
if (myexample.style.borderColor=="fuchsia")
myexample.style.borderColor="yellow"
else
myexample.style.borderColor="fuchsia"
}
setInterval("flashit()", 1000)
</script> 怎么没有代码呢? 你们真厉害 。。。我也想学学 很棒的效果!!! 不会
[ 本帖最后由 atu 于 2008-12-17 12:12 编辑 ] 你好厉害! 好漂亮啊,咋做的呢 不错哦~ 找不到代码啊
很棒呀,怎么做的呢?