Demo :
Cara membuatnya
Penempatannya :
dibawah <body>
........
diatas </body>
<div style="position:relative;left:0px;top:0px">
<span id="highlighter" style="position:absolute;left:0;top:0;font-size:18px;font-family:Verdana;background-color:yellow;color:#222;padding:5px;clip:rect(0px 0px auto 0px)"></span>
</div>
<script type='text/javascript'>
//<![CDATA[
/*
JavaScript Kit http://www.javascriptkit.com/script/cut57.shtml
*/
//Tempat pesan anda :
var tickercontents=new Array()
tickercontents[0]='Selamat Datang di Blog Nano Yulianto!!!'
tickercontents[1]='Tak ada yang bisa ditawarkan diblog ini'
tickercontents[2]='Ini hanya blog amatir'
var tickdelay=3000 //penundaan antara pesan
var highlightspeed=10 //kecepatan
////Do not edit pass this line////////////////
var currentmessage=0
var clipwidth=0
function changetickercontent(){
crosstick.style.clip="rect(0px 0px auto 0px)"
crosstick.innerHTML=tickercontents[currentmessage]
highlightmsg()
}
function highlightmsg(){
var msgwidth=crosstick.offsetWidth
if (clipwidth<msgwidth){
clipwidth+=highlightspeed
crosstick.style.clip="rect(0px "+clipwidth+"px auto 0px)"
beginclip=setTimeout("highlightmsg()",20)
}
else{
clipwidth=0
clearTimeout(beginclip)
if (currentmessage==tickercontents.length-1) currentmessage=0
else currentmessage++
setTimeout("changetickercontent()",tickdelay)
}
}
function start_ticking(){
crosstick=document.getElementById? document.getElementById("highlighter") : document.all.highlighter
crosstickParent=crosstick.parentNode? crosstick.parentNode : crosstick.parentElement
if (parseInt(crosstick.offsetHeight)>0)
crosstickParent.style.height=crosstick.offsetHeight+'px'
else
setTimeout("crosstickParent.style.height=crosstick.offsetHeight+'px'",100) //delay for Mozilla's sake
changetickercontent()
}
if (document.all || document.getElementById)
window.onload=start_ticking
//]]>
</script>
Credit : JavaScript Kit
Alhamdulillah
0 comments:
Posting Komentar