FLASH连接数据库


Posted on March 2, 2007


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>
  <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())%>' />
    </item></itemtemplate>
  </asp:repeater>
</xml>

后台代码:

private void Page_Load(object sender, System.EventArgs e)
{
	// 在此处放置用户代码以初始化页面
	//
	Response.ContentType = "Text/XML";
	Repeater1.DataSource = Topics.GetTop5TVIndex().Topics;
	Repeater1.DataBind();
}

标签:N/A

 

在线学习答案查询入口
微信扫码联系
微信扫码联系