简单的仿Flash文字动画(兼容Mozilla)_javascript技巧 2020年8月2日 23:09:31js教程评论221 views阅读模式 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> neverDhtmlText - http://www.never-online.net </title> <meta http-equiv="ImageToolbar" content="no" /> <meta name="author" content="BlueDestiny, never-online"/> <meta name="keywords" content="never modules, Mozilla CSS, C#, .net, Refercence, BlueDestiny, never-online, www.never-online.net"/> <meta name="description" content="BlueDestiny, never-online"/> <meta name="title" content="neverDhtmlText - http://www.never-online.net" /> <meta name="creator.name" content="Genius Lau, never-online, blueDestiny" /> <style type="text/css" media="all" title="Default"> body { background-color:#555; color:#aaa; font-size:12px; font-family: "Comic Sans MS"; } a { color:#aaa; } </style> <script type="text/javascript"> //<![CDATA[ // script by never-online, blueDestiny // blueDestiny[at]126.com // http://www.never-online.net // Permission given to use this script in ANY kind of applications if // header lines are left unchanged. function neverDhtmlText(wrapper,text) { var ie = document.all?true:false; window._m = cr = null; var cnt = 0; var delay=1.5; var idx=0; with(wrapper.style) { display = "block"; position = "absolute"; fontWeight = "bolder"; fontFamily = "Comic Sans MS"; } function animate(bool, idx) { window.clearTimeout(_m); if (bool?++cnt>100:--cnt<0) { window._m=setTimeout(function(){callback(!bool,(bool!=true&&idx==cr)?++idx:idx)},1000*delay); return; } variety(cnt, cnt); window._m=setTimeout(function(){animate(bool, idx)},10); } function variety(sz, alpha, bool, color) { with(wrapper.style) { left = parseInt(((document.body.clientWidth||window.innerWidth)-wrapper.offsetWidth)/2)+"px"; top = parseInt(((document.body.clientHeight||window.innerHeight)-wrapper.offsetHeight)/2)-50+"px"; fontSize = (bool?sz:(sz>50?50:sz))+"px"; ie?filter="alpha(opacity=" +alpha+ ")":MozOpacity=(alpha/100).toFixed(2)+""; wrapper.style.color = color?color:"gray"; } } function callback(bool, idx) { if (idx==text.length) { top.location.href='http://blog.never-online.net'; return }; wrapper.innerHTML = text[idx]; animate(bool,idx); cr=idx; }; callback(true,idx); }; function demostrate() { var o = document.getElementById("demo"); var a = ['welcome to','never-online\'s blog','http://www.never-online.net','go'] neverDhtmlText(o, a); a = null; }; onload = demostrate; //]]> </script> </head> <body id="www.never-online.net"> <div id="demo"></div> <div id="footWrapper" style="position:absolute; top:80%; text-align:center; width:100%;"> Power By never-online, BlueDestiny , <a href="http://www.never-online.net">http://www.never-online.net</a> </div> </body> </html> [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] 点赞 登录收藏 https://www.qieseo.com/384741.html 复制链接 复制链接