<style type='text/css'>
span.shock {
color: red;
align: right;
size: 14;
}
#display_area { width: 250;
background: yellow;
text-align: right;
}
</style>
<script type='text/javascript'>
var now = new Date();
for_a_total_of = ', 距今<br>';
var diane_lee = {date: new Date('2008/03/12'),
name : '李慶安',
date_text : '2008年3月12日',
scoop : '遭踢爆雙重國籍'}
var mao_kon = {date: new Date('2008/10/01'),
name : '貓纜',
date_text : '2008年10月1日',
scoop : 'Stonewall investigation '}
var ker = {date: new Date('2008/08/09'),
name : '
柯建銘',
date_text : '2008年8月9日',
scoop : '<span class=shock>控告馬英九叛國</span>'}
var tai = {date: new Date('2008/08/25'),
name : '
戴正德',
date_text : '2008年8月25日',
scoop : '<span class=shock>控告馬英九叛國</span>'}
var ah_bian = {date: new Date('2008/11/05'),
name : '陳水扁',
date_text : '2008年8月25日',
scoop : '<span class=shock>控告馬英九叛國</span>'}
var text = '';
var people = [diane_lee, mao_kon, ker, tai, ah_bian];
var decoration_start = '<span class=shock>'
var decoration_end = '</span>'
for (var i=0; i< people.length; i++){
var person = people[i];
person.total = Math.round((now - person.date)/86400000);
text += decoration_start + person.name + decoration_end
+ person.date_text + person.scoop + for_a_total_of +
decoration_start + person.total + decoration_end +
' 天' + '<p>' ;
}
var html = '<div id=display_area>' + text + '</div>'
document.write(html)
</script>
<a href=
http://docs.google.com/Doc?id=dfcgzjxz_33c2qnt6hr>Code</a><br>
<a href=http://zen.sandiego.edu/~liao/add_displaybox_widget.html>Add this widget to my Blogger blogs</a>