system.usecodepage = true;
_global.arrtitle = new array(5);
_global.arrimage = new array(5);
_global.arrurl = new array(5);
function loadxml()
{
myxml = new xml();
myxml.ignorewhite = true;
myxml.load("http://192.168.0.244/8mchina2/flash/tvindex.aspx");
myxml.onload = function(success)
{
if (success)
{
len = myxml.firstchild.childnodes.length;
for(i=0; i<5; i++)
{
_global.arrtitle[i] = myxml.firstchild.childnodes[i].attributes.title;
_global.arrimage[i] = myxml.firstchild.childnodes[i].attributes.image;
_global.arrurl[i] = myxml.firstchild.childnodes[i].attributes.url;
eval("_root.txt" + (i+1)).text = _global.arrtitle[i];
}
}
else
{
loadxml();
}
};
}
loadxml();
aspx文件处理:
<%@ import namespace="bmhd.components.components" %>
<%@ import namespace="bmhd.components" %>
<%@ page language="c#" codebehind="tvindex.aspx.cs" autoeventwireup="false" inherits="bmhd.web.xml.tvindex" %><?xml version="1.0" encoding="gb2312" ?>
<xml>
<asp:repeater id="repeater1" runat="server">
<itemtemplate>
<item id="<%# databinder.eval(container.dataitem, "id")%>" title="<%# databinder.eval(container.dataitem, "title")%>" url="<%# databinder.eval(container.dataitem, "link")%>" image="<%# topicpicture.getpictureurl(databinder.eval(container.dataitem, "imageurl").tostring())%>" />
</itemtemplate>
</asp:repeater>
</xml>
后台代码:
private void page_load(object sender, system.eventargs e)
{
// 在此处放置用户代码以初始化页面
//
response.contenttype = "text/xml";
repeater1.datasource = topics.gettop5tvindex().topics;
repeater1.databind();
}
新闻热点
疑难解答