去年在octopress站点上发了一篇祝包子生快的代码,转眼又是一年了,这一年时间过得好快。
把去年的代码修改了一下,再祝包子生日快乐,愿程序员之间的友谊天长地久~
iiiiiiiiiii
|~~~~~~~~~~~|
__|___________|__
|^^^^^^^^^^^^^^^^^|
| |
| |
~~~~~~~~~~~~~~~~~~~
本来文字逐个出现后就停止执行了,今年加了个循环,不是原来的的配方,还是熟悉的味道。把代码贴出来吧,送给大家。
打字机效果循环执行:
JS
<script type="text/javascript"> /**
* Happy Birthday Boris (code of printer loop)
* coder: xiaohudie
* 2014-06-24
*/
var a = "HappyBirthday Bao" ; var b = 0 ; setTimeout("birth()", 1000); function birth() { document.getElementById("hbbao").innerHTML = a.substring(0, b); if (b == a.length){ setTimeout("b=0",2000); } else{ b++; } setTimeout("birth()", 300); } </script>
HTML
<span id="hbbao"></span>
happybirthdayboris is coded by http://xiaohudie.net. Any posts here is one hundred percent original, so please keep my link so as not to hurt this pretty girl. -
我有一同学也叫包子
礼物很别致很有爱,程序员的世界
程序员的爱呀