Có một cách khắc phục điều này là sử dụng ngôn ngữ Javascript để tạo một widget độc lập cho blog của bạn mà không cần nhờ đến website thứ 3.
Đối với Blogger, bạn chỉ cần đặt đoạn code dưới đây vào trong một tiện ích HTML/JavaScript là có thể thành công. Lưu ý ở đây sử dụng thủ thuật hiển thị mỗi ngày một câu danh ngôn (quote) kèm theo tác giả (author) tương ứng. Trong đoạn code mẫu là những câu danh ngôn bằng tiếng Anh. Bạn nên thay thế bằng những câu danh ngôn tiếng Việt mà bạn thích kèm theo tác giả của câu danh ngôn đó.
<table border="1" bordercolor="#ADD8E6" cellpadding="20" width="200" bgcolor="#dff6ff" title="Danh ngôn chọn lọc"><tr><td><a target="_blank" href="http://huynh-nhat-ha.blogspot.com/2010/10/tao-widget-danh-ngon-trong-ngay-bang.html">Danh ngôn trong ngày</a><p></p><p></p>
<script language="javascript" type="text/javascript">
var d=new Date();
var quotes=new Array(31);
var authors=new Array(31);
quotes[0]="If a man watches three football games in a row, he should be declared legally dead.";
quotes[1]="Friendship is far more tragic than love. It lasts longer.";
quotes[2]="Advice is like castor oil, easy enough to give but dreadful uneasy to take.";
quotes[3]="Never trust men with short legs. Brains too near their bottoms.";
quotes[4]="Fame is failure disguised as money.";
quotes[5]="I always wait for The Times each morning. I look at the obituary column, and if I'm not in it, I go to work.";
quotes[6]="I just came from a pleasure trip: I took my mother-in-law to the airport.";
quotes[7]="Too bad that all the people who know how to run the country are busy driving taxicabs and cutting hair.";
quotes[8]="The success of the marriage comes after the failure of the honeymoon.";
quotes[9]="Husbands are like fires. They go out when unattended.";
quotes[10]="If one hears bad music, it is one's duty to drown it in conversation.";
quotes[11]="Being right half the time beats being half-right all the time.";
quotes[12]="If you do not know where you are going, every road will get you nowhere.";
quotes[13]="My wife is a light eater. As soon as it's light, she starts eating.";
quotes[14]="A door is what a dog is perpetually on the wrong side of.";
quotes[15]="Never trust a husband too far or a bachelor too near.";
quotes[16]="I can resist everything except temptation.";
quotes[17]="Education is not the filling of a pail, but the lighting of a fire.";
quotes[18]="Every one is a moon, and has a dark side which he never shows anybody.";
quotes[19]="Man is born free; and everywhere he is in chains.";
quotes[20]="Anger is never without an argument, but seldom with a good one.";
quotes[21]="Most folks are about as happy as they make up their minds to be.";
quotes[22]="Love and scandal are the best sweeteners of tea.";
quotes[23]="To find a friend one must close one eye. To keep him - two.";
quotes[24]="I've made it a rule never to drink by daylight and never to refuse a drink after dark.";
quotes[25]="When I read about the evils of drinking, I gave up reading.";
quotes[26]="When work is a pleasure, life is a joy! When work is duty, life is slavery.";
quotes[27]="She used to diet on any kind of food she could lay her hands on.";
quotes[28]="An uneasy conscience is a hair in the mouth.";
quotes[29]="Bigamy is having one wife too many. Monogamy is the same.";
quotes[30]="My idea of an agreeable person is a person who agrees with me.";
authors[0]="Erma Bombeck";
authors[1]="Oscar Wilde";
authors[2]="Josh Billings";
authors[3]="Noel Coward";
authors[4]="Brendan Behan";
authors[5]="A. E. Matthews";
authors[6]="Henny Youngman";
authors[7]="George Burns";
authors[8]="G. K. Chesterton";
authors[9]="Zsa Zsa Gabor";
authors[10]="Oscar Wilde";
authors[11]="Malcolm Forbes";
authors[12]="Henry Kissinger";
authors[13]="Henny Youngman";
authors[14]="Ogden Nash";
authors[15]="Helen Rowland";
authors[16]="Oscar Wilde";
authors[17]="William Butler Yeats";
authors[18]="Mark Twain";
authors[19]="Jean-Jacques Rousseau";
authors[20]="Lord Halifax";
authors[21]="Abraham Lincoln";
authors[22]="Henry Fielding";
authors[23]="Norman Douglas";
authors[24]="H. L. Mencken";
authors[25]="Henny Youngman";
authors[26]="Maxim Gorky";
authors[27]="Arthur 'Bugs' Baer";
authors[28]="Mark Twain";
authors[29]="Oscar Wilde";
authors[30]="Benjamin Disraeli";
document.write(quotes[d.getDate()-1] + '<p style="text-align: right"><i>' + authors[d.getDate()-1] + '</i></p>');</script><noscript>You need to enable JavaScript to read this.</noscript></td></tr></table>
Nếu bạn biết chút ít về CSS thì có thể tùy chỉnh màu nền và trang trí widget túy ý và tất nhiên là cần phải chỉnh độ rộng (width) cho phù hợp với độ rộng của sidebar trên blog của bạn.
Chúc bạn thành công!
{ 0 comments... read them below or add one }
Post a Comment