Subscribe:

Main Menu

Rabu, Juni 11, 2008

Smiley di Blogger

Saya lihat-lihat kayaknya kok ada yang kurang ya di blog saya? setelah di lihat - lihat kayaknya kurang ada ekspresinya :D Akhirnya kemarin saya mencoba untuk menambahkan smiley di blogger saya. biasanya para blogger nambahin smileynya dengan cara add image.. tapi kayaknya kurang enak kalo gitu. dan akhirnya saya berhasil nambahin smiley tanpa add image segala :D yaitu dengan cukup ngetik : ama D saya bisa nampilin gambar :D. berikut cara-caranya

Pertama tambahin elemen halaman di blog anda. tambahkan script ini


<script type="text/javascript">
<!--

function replaceText() {
// no support
if(!document.getElementById) {
return;
}

bodyText = document.getElementById("body");
theText = bodyText.innerHTML;

// replace
theText = theText.replace(/;\)/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/wink.gif" alt=";)" /> ');
theText = theText.replace(/;-\)/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/wink.gif" alt=";-)" /> ');
theText = theText.replace(/:D/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/biggrin.gif" alt=":D" /> ');
theText = theText.replace(/:-D/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/biggrin.gif" alt=":-D" /> ');
theText = theText.replace(/B\)/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/cool.gif" alt="B)" /> ');
theText = theText.replace(/B-\)/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/cool.gif" alt="B-)" /> ');
theText = theText.replace(/:x/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/mad.gif" alt=":x" /> ');
theText = theText.replace(/:X/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/mad.gif" alt=":X" /> ');
theText = theText.replace(/:-x/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/mad.gif" alt=":-x" /> ');
theText = theText.replace(/:-X/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/mad.gif" alt=":-X" /> ');
theText = theText.replace(/:-\(/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/sad.gif" alt=":-(" /> ');
theText = theText.replace(/:\(/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/sad.gif" alt=":(" /> ');
theText = theText.replace(/:o/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/ohmy.gif" alt=":o" /> ');
theText = theText.replace(/:O/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/ohmy.gif" alt=":O" /> ');
theText = theText.replace(/:-o/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/ohmy.gif" alt=":-o" /> ');
theText = theText.replace(/:-O/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/ohmy.gif" alt=":-O" /> ');
theText = theText.replace(/:p/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/tongue.gif" alt=":p" /> ');
theText = theText.replace(/:-p/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/tongue.gif" alt=":-p" /> ');
theText = theText.replace(/:-P/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/tongue.gif" alt=":-P" /> ');
theText = theText.replace(/:P/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/tongue.gif" alt=":P" /> ');
theText = theText.replace(/:-\)/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/smile.gif" alt=":-)" /> ');
theText = theText.replace(/:\)/g,'<img style="border:none;vertical-align:middle" src="http://photos1.blogger.com/blogger/7678/802/1600/smile.gif" alt=":)" /> ');

bodyText.innerHTML = theText;
}

-->
</script>
<!--BloggerEmoticons-->


Langkah kedua :
edit layout anda terus edit HTML nya

cari tag body, ganti tag body menjadi seperti ini nech

< body id='body' onload='replaceText();'>



setelah itu save templates. kalo udah sukses seharusnya dalam blogger anda. jika anda mengetik : dan D seharunya akan muncul gambar ini :D


0 komentar: