Phiên bản đầy đủ: jsB@nk » Chữ » Hoạt hóa » Chữ va chạm trong khung
URL: https://www.javascriptbank.com/greetingsnake-2-the-crazy-way-to-say-hello-to-your-visitors.html
Hiệu ứng tạo ra các dòng chữ di chuyển">di chuyển và va chạm trong một khung trên trang web.
Phiên bản đầy đủ: jsB@nk » Chữ » Hoạt hóa » Chữ va chạm trong khung
URL: https://www.javascriptbank.com/greetingsnake-2-the-crazy-way-to-say-hello-to-your-visitors.html
<SCRIPT><!-- Beginning of JavaScript -// GreetingSnake 2// your message. A long message will slow down the effectvar your_message="HI VISITOR"// font-familyvar messagefont="Verdana"// font-sizevar messagesize=9// font-colorvar messagecolor="FF0000"// font-weight (boldness). Set it to a value between 1 and 9var messageboldness=1// the height of the ticker (pixels)var tickerheight=90// the width of the ticker (pixels)var tickerwidth=500// scroller's distance to the left margin of the browser-window (pixels)var tickerleftposition=100// scroller's distance to the top margin of the browser-window (pixels)var tickertopposition=10// speedvar tempo=50// average horizontal distance between the lettersvar stepx=9// average vertical distance between the lettersvar stepy=9// do not edit the variables belowvar msg=new Array()var msg=your_messagevar message=msg.split("")var numberofletters=msg.length-1var x,ymessageboldness=messageboldness*100var timervar xpos=new Array()var ypos=new Array()var spancontent=new Array()if (document.all) {for (i=0;i<=numberofletters;i++) {spancontent[i]="<span style='position:relative;font-family:"+messagefont+";font-size:"+messagesize+"pt;color:"+messagecolor+";font-weight:"+messageboldness+"'>"+message[i]+"</span>"}}function setValues() {if (document.all) {for (i=0;i<=numberofletters;i++) { xpos[i]=tickerwidth-3 ypos[i]=tickerheight-3 var thisspan = eval("document.all.span"+i) thisspan.innerHTML=spancontent[i]var thisspan = eval("document.all.span"+(i)+".style") thisspan.posLeft=tickerwidth-3 thisspan.posTop=tickerheight-3 thisspan.visibility="visible"}moveball()}}function randommaker(range) {rand=Math.floor(range*Math.random()) return rand}function moveball() {if (document.all) {checkposition() makesnake() document.all.span0.style.posTop+=stepy timer=setTimeout("moveball()",tempo)}}function makesnake() {for (i=numberofletters; i>=1; i--) { xpos[i]=xpos[i-1]ypos[i]=ypos[i-1] }if (document.all) {xpos[0]=document.all.span0.style.posLeft+stepxypos[0]=document.all.span0.style.posTop+stepyfor (i=0;i<=numberofletters;i++) { var thisspan=eval("document.all.span"+(i)+".style") thisspan.posLeft=xpos[i]thisspan.posTop=ypos[i] }}}function checkposition() {if (document.all) {if (document.all.span0.style.posLeft>tickerwidth) {stepx=(stepx+randommaker(2))*-1document.all.span0.style.posLeft-=1}if (document.all.span0.style.posLeft<tickerleftposition) {stepx=(stepx+randommaker(2))*-1document.all.span0.style.posLeft+=1}if (document.all.span0.style.posTop>tickerheight) {stepy=(stepy+randommaker(2))*-1document.all.span0.style.posTop-=1}if (document.all.span0.style.posTop<tickertopposition) {stepy=(stepy+randommaker(2))*-1document.all.span0.style.posTop+=1}}}for (i=0;i<=numberofletters;i++) { document.write("<span id='span"+i+"' style='position:absolute;;visibility:hidden'></span>") document.close()}window.onload=setValues</script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->