<h3 class="listtitle">最新文章 <span>(<a href="">如何实现?</a>)</span></h3>
<ul class="list" id="my_last_post"></ul><ul class="list"><li>
<script type="text/javascript"><!--
var xmlhttp = false;
function load_rss()
{
xmlhttp = false;
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
if (xmlhttp.overrideMimeType)
{
xmlhttp.overrideMimeType('text/xml');
}
}
else if (window.ActiveXObject)
{
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
}
}
}
if(!xmlhttp)
{
return;
}
xmlhttp.onreadystatechange = proc_rss;
xmlhttp.open('GET', '/concorde/rss.aspx', true);
xmlhttp.send(null);
}
function proc_rss()
{
if (xmlhttp.readyState == 4)
{
if (xmlhttp.status == 200)
{
var items = xmlhttp.responseXML.getElementsByTagName('item');
var l = 6;
if(items.length < 6)
{
l = items.length;
}
var html = '';
for (var i = 0; i < l; i++)
{
html = html + get_item(items, i);
}
var obj = document.getElementById('my_last_post');
if(obj)
{
obj.innerHTML = html;
}
}
}
}
function get_item(items, id)
{
var link = items[id].getElementsByTagName('link').item(0).firstChild.nodeValue;
var title = items[id].getElementsByTagName('title').item(0).firstChild.nodeValue;
var item = '<li class="listitem"><a href="' + link + '">' + title + '</a></li>';
return item;
}
load_rss();
file://-->
</script>