26 Januari 2011

Banner yang random untuk blog

1 ulasan:
 




Widget yang akan menunjukkan banner secara rawak kat blog korang apabila pelawat klik pada page yang baru atau pun bila refresh(F5).Jadi korang boleh letak lebih dari empat banner.

Sila lihat Demo(perhatikan pada sidebar Iklan,dan klik F5 untk lihat banner berubah)









Ok,ikut Langkah langkah ni:

1. Sign in ke Blogger > Design/Layout > Page Elements
2. Pilih HTML/JavaScript
3. Dan pastekan kod ni didalamnya

<div align="center">
<table border="0" cellpadding="2" cellspacing="6" width="265" bgcolor="#ffffff">
<tbody><tr>
<td><center>

<!-- BANNER#1 -->

<script language="JavaScript">
images = new Array(2);

images[0] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='http://lh3.ggpht.com/_7wsQzULWIwo/SwBO-OReszI/AAAAAAAACL4/kGhjYD-bEWc/Bill-board%5B3%5D.gif?imgmax=800' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";

images[1] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='http://lh6.ggpht.com/_7wsQzULWIwo/SwBPCRl810I/AAAAAAAACME/wtXSMFtKsNQ/Hand%20Drawing%5B3%5D.gif?imgmax=800' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";

index = Math.floor(Math.random() * images.length);
document.write(images[index]);
</script>

</center></td>

<td><center>

<!-- BANNER#2 -->

<script language="JavaScript">
images = new Array(2);

images[0] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='http://lh4.ggpht.com/_7wsQzULWIwo/SwBPDpelTcI/AAAAAAAACMI/oJzrJZUINT8/bill%20black%5B3%5D.gif?imgmax=800' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";

images[1] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='http://lh4.ggpht.com/_7wsQzULWIwo/SwBPHb56wmI/AAAAAAAACMM/XqhijacJz74/Spinner%5B3%5D.gif?imgmax=800' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";

index = Math.floor(Math.random() * images.length);
document.write(images[index]);
</script>

</center></td>
</tr>
<tr>

<td><center>

<!-- BANNER#3 -->

<script language="JavaScript">
images = new Array(2);

images[0] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='http://lh6.ggpht.com/_7wsQzULWIwo/SwBPIkkvgYI/AAAAAAAACMQ/B5npQ7hOxD4/blue%5B3%5D.gif?imgmax=800' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";

images[1] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='http://lh3.ggpht.com/_7wsQzULWIwo/SwBPRs50dsI/AAAAAAAACMk/zMOy9cDM2aY/wooden%5B3%5D.gif?imgmax=800' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";

index = Math.floor(Math.random() * images.length);
document.write(images[index]);
</script>

</center></td>

<td><center>

<!-- BANNER#4 -->

<script language="JavaScript">
images = new Array(2);

images[0] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='http://lh6.ggpht.com/_7wsQzULWIwo/SwBPOnTHePI/AAAAAAAACMc/ks7fawsx36w/Reading%20Style%5B3%5D.gif?imgmax=800' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";

images[1] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='http://lh6.ggpht.com/_7wsQzULWIwo/SwBPKdh4zfI/AAAAAAAACMU/eHEDTlmt3SM/simple%5B3%5D.gif?imgmax=800' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";

index = Math.floor(Math.random() * images.length);
document.write(images[index]);
</script>

</center></td>

</tr>

</tbody></table>

<table border="0" bordercolor="#0084ce" cellpadding="2" cellspacing="6" width="265" bgcolor="#ffffff">
<tbody>
<tr>


</tr></tbody></table>

</div>

Gantikan kod hijau dengan gambar/banner yang korang ingin dan kod merah adalah url untuk link banner tersebut.Ok,harap korang suka.Biru jika nak letak penerangan berkaitan iklan,biarkan camtu pun bleh.



1 ulasan:

TERIMA KASIH UNTUK KOMENKOMEN TERBARU

 
© 1986. Aideal Fitri - fitri1986 Malaysian Blogger