Cara Membuat Expandable ticker
Expandable ticker ini dapat memperluas ticker reguler. Terbuka dengan memberikan pesan, baik dalam urutan (satu per satu) secara opsional,atau sekaligus. Tidak harus menunggu untuk mendapatkan sebuah pesan yang Anda lihat sebelumnya!
<style>
<!--
#listbutton{
border:1px solid #4B4B4B;
background-color:#F3F3F3;
width:50px;
height:12px;
font: normal 11px Arial;
text-align:center;
cursor:pointer;cursor:hand;
}
.expandhighlight, .expandhighlight a{
color:red;
}
-->
</style>
<script language="JavaScript1.2">
//Expandable ticker - Buku Catatan si Ugi
//For full source code and more DHTML scripts, visit http://www.caprt3a.blogspot.com
//This credit MUST stay intact for use
//configure tickercontents[] to set the messges you wish be displayed (HTML codes accepted)
var tickercontents=new Array()
tickercontents[0]='See what\'s New at Buku Catatan si Ugi. <a href="http://www.caprt3a.blogspot.com">[Read more]</a>'
tickercontents[1]='Browse the most popular Entri on Buku Catatan si Ugi <a href="http://www.caprt3a.blogspot.com">[Read more]</a>'
tickercontents[2]='<a href="http://www.caprt3a.blogspot.com">Link back to Buku Catatan si Ugi!</a>'
//configure the below 2 variables to set the width/background color of the ticker
var tickerwidth='475px'
var tickerbgcolor='#DDDDFF'
//configure the below variable to determine the delay between ticking of messages (in miliseconds)
var tickdelay=3000
////Do not edit pass this line////////////////
var ie4=document.all
var ns6=document.getElementById
var ns4=document.layers
var currentmessage=0
var tickercontentstotal=''
function changetickercontent(){
if (ns4){
tickerobj.document.tickernssub.document.write('<b><a href="#" onClick="return expandlist(event)">Expand</a></b> | '+tickercontents[currentmessage])
tickerobj.document.tickernssub.document.close()
}
else if (ie4||ns6){
tickerobj.innerHTML=tickercontents[currentmessage]
previousmessage=(currentmessage==0)? tickercontents.length-1 : currentmessage-1
tickerexpand_item=ns6? document.getElementById("expand"+currentmessage) : eval("expand"+currentmessage)
tickerexpand_previousitem=ns6? document.getElementById("expand"+previousmessage) : eval("expand"+previousmessage)
tickerexpand_previousitem.className=""
tickerexpand_item.className="expandhighlight"
}
currentmessage=(currentmessage==tickercontents.length-1)? 0 : currentmessage+1
setTimeout("changetickercontent()",tickdelay)
}
function start_ticking(){
if (ns4) document.tickernsmain.visibility="show"
tickerobj=ie4? tickerlist : ns6? document.getElementById("tickerlist") : ns4? document.tickernsmain : ""
tickerexpandobj=ie4? tickerexpand : ns6? document.getElementById("tickerexpand") : ns4? document.expandlayer : ""
for (i=0;i<tickercontents.length;i++) //get total scroller contents
tickercontentstotal+='<div id="expand'+i+'">- '+tickercontents[i]+'</div>'
if (ie4||ns6)
tickerexpandobj.innerHTML=tickercontentstotal
else{
tickerexpandobj.document.write(tickercontentstotal)
tickerexpandobj.document.close()
}
changetickercontent()
}
function expandlist(e){
if (ie4||ns6){
tickerexpand_parent=ie4? tickerexpand.parentElement : document.getElementById("tickerexpand").parentNode
tickerexpand_parent.style.display=(tickerexpand_parent.style.display=="none")? "" : "none"
}
else{
document.expandlayer.left=e.pageX-e.layerX
document.expandlayer.top= e.pageY-e.layerY+20
document.expandlayer.visibility=(document.expandlayer.visibility=="hide")? "show" : "hide"
return false
}
}
if (ie4||ns6)
document.write('<table border="0" style="width:'+tickerwidth+';border:1px solid black;text-indent:2px" bgcolor="'+tickerbgcolor+'" cellspacing="0" cellpadding="0"><tr><td width="90%" id="tickerlist" bgcolor="'+tickerbgcolor+'"></td><td width="10%" bgcolor="'+tickerbgcolor+'"><div id="listbutton" onClick="expandlist()">Expand</div></td></tr><tr style="display:none"><td id="tickerexpand" width="90%" bgcolor="'+tickerbgcolor+'"> </td><td width="10%"></td></tr></table>')
window.onload=start_ticking
</script>
<ilayer id="tickernsmain" width=&{tickerwidth}; bgColor=&{tickerbgcolor}; visibility=hide><layer id="tickernssub" width=&{tickerwidth}; left=0 top=0></layer></ilayer>
<layer id="expandlayer" bgColor=&{tickerbgcolor}; visibility=hide></layer>
Contoh:
Cara Memasang Expandable ticker
Langkah Pertama:
Tambahkan kode CSS berikut ini diatas kode </head><style>
<!--
#listbutton{
border:1px solid #4B4B4B;
background-color:#F3F3F3;
width:50px;
height:12px;
font: normal 11px Arial;
text-align:center;
cursor:pointer;cursor:hand;
}
.expandhighlight, .expandhighlight a{
color:red;
}
-->
</style>
Langkah Kedua:
Pasang script contoh berikut ini pada <body> halaman anda.<script language="JavaScript1.2">
//Expandable ticker - Buku Catatan si Ugi
//For full source code and more DHTML scripts, visit http://www.caprt3a.blogspot.com
//This credit MUST stay intact for use
//configure tickercontents[] to set the messges you wish be displayed (HTML codes accepted)
var tickercontents=new Array()
tickercontents[0]='See what\'s New at Buku Catatan si Ugi. <a href="http://www.caprt3a.blogspot.com">[Read more]</a>'
tickercontents[1]='Browse the most popular Entri on Buku Catatan si Ugi <a href="http://www.caprt3a.blogspot.com">[Read more]</a>'
tickercontents[2]='<a href="http://www.caprt3a.blogspot.com">Link back to Buku Catatan si Ugi!</a>'
//configure the below 2 variables to set the width/background color of the ticker
var tickerwidth='475px'
var tickerbgcolor='#DDDDFF'
//configure the below variable to determine the delay between ticking of messages (in miliseconds)
var tickdelay=3000
////Do not edit pass this line////////////////
var ie4=document.all
var ns6=document.getElementById
var ns4=document.layers
var currentmessage=0
var tickercontentstotal=''
function changetickercontent(){
if (ns4){
tickerobj.document.tickernssub.document.write('<b><a href="#" onClick="return expandlist(event)">Expand</a></b> | '+tickercontents[currentmessage])
tickerobj.document.tickernssub.document.close()
}
else if (ie4||ns6){
tickerobj.innerHTML=tickercontents[currentmessage]
previousmessage=(currentmessage==0)? tickercontents.length-1 : currentmessage-1
tickerexpand_item=ns6? document.getElementById("expand"+currentmessage) : eval("expand"+currentmessage)
tickerexpand_previousitem=ns6? document.getElementById("expand"+previousmessage) : eval("expand"+previousmessage)
tickerexpand_previousitem.className=""
tickerexpand_item.className="expandhighlight"
}
currentmessage=(currentmessage==tickercontents.length-1)? 0 : currentmessage+1
setTimeout("changetickercontent()",tickdelay)
}
function start_ticking(){
if (ns4) document.tickernsmain.visibility="show"
tickerobj=ie4? tickerlist : ns6? document.getElementById("tickerlist") : ns4? document.tickernsmain : ""
tickerexpandobj=ie4? tickerexpand : ns6? document.getElementById("tickerexpand") : ns4? document.expandlayer : ""
for (i=0;i<tickercontents.length;i++) //get total scroller contents
tickercontentstotal+='<div id="expand'+i+'">- '+tickercontents[i]+'</div>'
if (ie4||ns6)
tickerexpandobj.innerHTML=tickercontentstotal
else{
tickerexpandobj.document.write(tickercontentstotal)
tickerexpandobj.document.close()
}
changetickercontent()
}
function expandlist(e){
if (ie4||ns6){
tickerexpand_parent=ie4? tickerexpand.parentElement : document.getElementById("tickerexpand").parentNode
tickerexpand_parent.style.display=(tickerexpand_parent.style.display=="none")? "" : "none"
}
else{
document.expandlayer.left=e.pageX-e.layerX
document.expandlayer.top= e.pageY-e.layerY+20
document.expandlayer.visibility=(document.expandlayer.visibility=="hide")? "show" : "hide"
return false
}
}
if (ie4||ns6)
document.write('<table border="0" style="width:'+tickerwidth+';border:1px solid black;text-indent:2px" bgcolor="'+tickerbgcolor+'" cellspacing="0" cellpadding="0"><tr><td width="90%" id="tickerlist" bgcolor="'+tickerbgcolor+'"></td><td width="10%" bgcolor="'+tickerbgcolor+'"><div id="listbutton" onClick="expandlist()">Expand</div></td></tr><tr style="display:none"><td id="tickerexpand" width="90%" bgcolor="'+tickerbgcolor+'"> </td><td width="10%"></td></tr></table>')
window.onload=start_ticking
</script>
<ilayer id="tickernsmain" width=&{tickerwidth}; bgColor=&{tickerbgcolor}; visibility=hide><layer id="tickernssub" width=&{tickerwidth}; left=0 top=0></layer></ilayer>
<layer id="expandlayer" bgColor=&{tickerbgcolor}; visibility=hide></layer>
Keterangan:
Silahkan konfigurasikan sesuai keinginan anda, lihat contoh pada text yang berwarna diatas.
0 komentar:
Post a Comment
Catatan :
Untuk menyisipkan gambar kedalam komentar, gunakan tag : [img]URL_Gambar[/img]
atau <i rel="image">URL_Gambar</i>
Untuk Video Youtube : [youtube]URL_Video[/youtube]
atau <i rel="youtube">URL_Video</i>
Untuk "Kutipan", gunakan : [blockquote]Kutipan_Anda[/blockquote]
atau <b rel="quote">Kutipan_Anda</b>
Untuk menyisipkan Kode: [code]KODE[/code]
atau <i rel="code">KODE</i>
atau <i rel="pre">KODE</i>
Dan untuk menyisipkan smiles/ emoticon, lihat kode Emoticon