Sunday, March 15, 2009

Highlighter Scroller Sebagai Mini Post

Highlighter Scroller ?? Gak tau juga gimana neranginnya. Pokok nya itu lah.. Highlighter Scroller bisa dijadikan sebagai mini post, menu blog, atau mungkin sebagai blogroll. Aku dapat script ini dari Javascriptkit. Dari keterangan, script ini tinggal masukin dimana sobat mau nempatin Highlighter Scroller nya. Mudah bukan??
Sebelumnya sih aku coba utak-utik lewat Edit HTML tapi berhubung aku gak paham dengan yg namanya kode-kode, jadinya aku gak tau harus ditaruh dimana,heheheheee...

Langkah-langkah membuat Highlighter Scroller :

1. Masuk ke Page Element
2. Add elemen HTML
3. Copat kode yg ada dibawah ini, dan SAVE

Berikut ini adalah kode script nya :


<script type="text/javascript">

//CONFIGURE MESSAGES AND VARIABLES
var tickercontents=new Array()
tickercontents[0]='Looking for template?? Visit <a href="http://dhe-gallery.blogspot.com" target="_blank">Dhe-Gallery</a>!'
tickercontents[1]='You can get <a href="http://moneylocker.blogspot.com" target="_blank">Free Money</a> from many programs here !'
tickercontents[2]='Get your <a href="http://azthemes.blogspot.com" target="_blank">Professional Theme</a>,high quality and SEO Support'
tickercontents[3]='<a href="http://blogcenti.blogspot.com">Just a Blog</a>Apa ayng ku lihat, ku dengar, dan ku rasa !'

var tickerwidth="160px"
var tickerheight="80px"
var fontcss="font: bold 14px Verdana; color:black"
var tickdelay=3000 //delay btw messages
var highlightspeed=2 //2 pixels at a time.
var highlightcolor="#9ff9ff"
var backdroptextcolor="#1e0e0e"

////Do not edit pass this line////////////////

document.write('<style>#highlighterbg a{color:'+backdroptextcolor+'}</style>')
document.write('<div style="position:relative;left:0px;top:0px; width:'+tickerwidth+'; height:'+tickerheight+';'+fontcss+'">')
document.write('<span id="highlighterbg" style="position:absolute;left:0;top:0; width:'+tickerwidth+'; height:'+tickerheight+';padding: 4px"></span><span id="highlighter" style="position:absolute;left:0;top:0;clip:rect(auto auto auto 0px); background- width:'+tickerwidth+';height:'+tickerheight+';padding: 4px"></span>')
document.write('</div>')

var currentmessage=0
var clipbottom=1

function changetickercontent(){
msgheight=clipbottom=crosstick.offsetHeight
crosstick.style.clip="rect("+msgheight+"px auto auto 0px)"
crosstickbg.innerHTML=tickercontents[currentmessage]
crosstick.innerHTML=tickercontents[currentmessage]
highlightmsg()
}

function highlightmsg(){
//var msgheight=crosstick.offsetHeight
if (clipbottom>0){
clipbottom-=highlightspeed
crosstick.style.clip="rect("+clipbottom+"px auto auto 0px)"
beginclip=setTimeout("highlightmsg()",20)
}
else{
clipbottom=msgheight
clearTimeout(beginclip)
if (currentmessage==tickercontents.length-1) currentmessage=0
else currentmessage++
setTimeout("changetickercontent()",tickdelay)
}
}

function start_ticking(){
crosstickbg=document.getElementById? document.getElementById("highlighterbg") : document.all.highlighterbg
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>

<a href="http://javascriptkit.com">JavaScript Kit</a> | <a href="http://blogcenti.blogspot.com">Just a blog</a>


Hasilnya akan seperti ini. Lihatdemo

Keterangan : Ganti sesuaikan dengan selera sobat
- warna merah = ganti dengan text atau link sobat
- warna biru = lebar dan tinggi Highlighter Scroller
- warna biru tua = jenis dan ukuran font
- warna hijau = warna background dan warna link url

Jika ingin menambahkan text atau link di Highlighter Scroller, sobat tinggal tambahkan seperti contoh berikut :

tickercontents[3]='<a href="http://blogcenti.blogspot.com">Just a Blog</a>Apa ayng ku lihat, ku dengar, dan ku rasa !'

Ket : angaka yg di cetak tebal,merupakan no urut text dan link sobat. Ganti sesuai dengan no urut.

No comments:

Post a Comment