index.aspx
<script>
//创建XMLHttpRequest对象
var request = false;
try {
request = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
request = false;
}
}
}
if (!request)alert("Error initializing XMLHttpRequest!");
//获取信息
var url = "FlashImage.aspx"; //跳转到操作页面
request.open("GET", url, true);
request.onreadystatechange = updatePage;
request.send(null);
var str;
//更新页面
function updatePage() {
if (request.readyState == 4) {
if (request.status == 200) {
str= request.responseText; //操作页面返回的值
}else if(request.status == 404) {
alert ("Requested URL is not found.");
} else if (request.status == 403) {
alert("Access denied.");
} else
alert("status is " + request.status);
}
}
if(str=="" || str==null)
{
location .reload();
}
var strrt=str.split('@');
var pics;
var texts;
pics=strrt[1];
texts=strrt[0];
var focus_width=425
var focus_height=227
var text_height=18
var swf_height = focus_height+text_height
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="images/focus1.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('</object>');
</script>
FlashImage.aspx: //在此页面读取数据
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FlashImage.aspx.cs" Inherits="FlashImage" %>
<%
System.Collections.Generic.IList<PipeModels.Flash> listurl = PipeBLL.FlashManager.GetAllFlashes();
string str="";
string str2 = "";
for (int t = 0; t < listurl.Count; t++)
{
string imgtext1 = listurl[t].Title;
string imgUrl1 = listurl[t].Url;
str = str + imgtext1 + "|";
str2 += imgUrl1 + "|";
}
string strr = str.Substring(0, str.Length - 1);
string strr2 = str2.Substring(0, str2.Length - 1);
Response.Write(strr + "@" + strr2);
%>