静态实现
Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ImageDemo._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" language="javascript">
function ImgTran()
{
var imgArr=[{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage1.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/ay_wlan_wxty.htm'),imgtext:'链接1'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage2.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/ehome.htm'),imgtext:'链接2'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage3.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/sdy.htm'),imgtext:'链接3'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage4.jpg',imgLink:escape('http://onehome.gd.vnet.cn/htmlpages/huapi/index.htm'),imgtext:'链接4'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage5.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/hero1.htm'),imgtext:'链接5'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage6.jpg',imgLink:escape('http://www.gznet.com/telecom/zt/ehome0815/index.html'),imgtext:'链接6'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage7.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/jsyq.htm'),imgtext:'链接7'}
];
var jscode="";
var focus_width=578 ;
var focus_height=200 ;
var text_height=20;
var swf_height = focus_height+text_height ;
var pics="";
var links="";
var texts="";
for(var i=0;i<imgArr.length;i++)
{
if(i==0)
{
pics+=imgArr[i].imgUrl;
links+=imgArr[i].imgLink;
texts+= imgArr[i].imgtext;
}
else
{
pics+="|"+imgArr[i].imgUrl;
links+="|"+imgArr[i].imgLink;
texts+="|"+ imgArr[i].imgtext;
}
}
jscode+='<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 +'">';
jscode+='<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">';
jscode+='<param name="menu" value="false"><param name=wmode value="opaque">';
jscode+='<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">';
jscode+='<embed src="pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
jscode+='</object>';
document.getElementById("flashImg").innerHTML=jscode;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="flashImg" style="text-align:center">
<!--************动态图片**************-->
</div>
<script type="text/javascript">
ImgTran();
</script>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ImageDemo._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" language="javascript">
function ImgTran()
{
var imgArr=[{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage1.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/ay_wlan_wxty.htm'),imgtext:'链接1'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage2.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/ehome.htm'),imgtext:'链接2'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage3.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/sdy.htm'),imgtext:'链接3'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage4.jpg',imgLink:escape('http://onehome.gd.vnet.cn/htmlpages/huapi/index.htm'),imgtext:'链接4'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage5.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/hero1.htm'),imgtext:'链接5'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage6.jpg',imgLink:escape('http://www.gznet.com/telecom/zt/ehome0815/index.html'),imgtext:'链接6'},
{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage7.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/jsyq.htm'),imgtext:'链接7'}
];
var jscode="";
var focus_width=578 ;
var focus_height=200 ;
var text_height=20;
var swf_height = focus_height+text_height ;
var pics="";
var links="";
var texts="";
for(var i=0;i<imgArr.length;i++)
{
if(i==0)
{
pics+=imgArr[i].imgUrl;
links+=imgArr[i].imgLink;
texts+= imgArr[i].imgtext;
}
else
{
pics+="|"+imgArr[i].imgUrl;
links+="|"+imgArr[i].imgLink;
texts+="|"+ imgArr[i].imgtext;
}
}
jscode+='<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 +'">';
jscode+='<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">';
jscode+='<param name="menu" value="false"><param name=wmode value="opaque">';
jscode+='<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">';
jscode+='<embed src="pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
jscode+='</object>';
document.getElementById("flashImg").innerHTML=jscode;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="flashImg" style="text-align:center">
<!--************动态图片**************-->
</div>
<script type="text/javascript">
ImgTran();
</script>
</form>
</body>
</html>
动态实现
Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default2.aspx.cs" Inherits="ImageDemo.Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" language="javascript">
function ImgTran()
{
var jscode="";
var focus_width=578 ;
var focus_height=200 ;
var text_height=20;
var swf_height = focus_height+text_height ;
var pics="";
var links="";
var texts="";
for(var i=0;i<imgArr.length;i++)
{
if(i==0)
{
pics+=imgArr[i].imgUrl;
links+=imgArr[i].imgLink;
texts+= imgArr[i].imgtext;
}
else
{
pics+="|"+imgArr[i].imgUrl;
links+="|"+imgArr[i].imgLink;
texts+="|"+ imgArr[i].imgtext;
}
}
jscode+='<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 +'">';
jscode+='<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">';
jscode+='<param name="menu" value="false"><param name=wmode value="opaque">';
jscode+='<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">';
jscode+='<embed src="pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
jscode+='</object>';
document.getElementById("flashImg").innerHTML=jscode;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="flashImg" style="text-align:center">
<!--************动态图片**************-->
</div>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default2.aspx.cs" Inherits="ImageDemo.Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" language="javascript">
function ImgTran()
{
var jscode="";
var focus_width=578 ;
var focus_height=200 ;
var text_height=20;
var swf_height = focus_height+text_height ;
var pics="";
var links="";
var texts="";
for(var i=0;i<imgArr.length;i++)
{
if(i==0)
{
pics+=imgArr[i].imgUrl;
links+=imgArr[i].imgLink;
texts+= imgArr[i].imgtext;
}
else
{
pics+="|"+imgArr[i].imgUrl;
links+="|"+imgArr[i].imgLink;
texts+="|"+ imgArr[i].imgtext;
}
}
jscode+='<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 +'">';
jscode+='<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">';
jscode+='<param name="menu" value="false"><param name=wmode value="opaque">';
jscode+='<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">';
jscode+='<embed src="pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
jscode+='</object>';
document.getElementById("flashImg").innerHTML=jscode;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="flashImg" style="text-align:center">
<!--************动态图片**************-->
</div>
</form>
</body>
</html>
Code
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
namespace ImageDemo
{
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
CreatePhotoTran();
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "createPhotoJson", "ImgTran();", true);
}
private void CreatePhotoTran()
{
StringBuilder photoJson = new StringBuilder();
photoJson.Append("imgArr = [");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage1.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/ay_wlan_wxty.htm'),imgtext:'链接1'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage2.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/ehome.htm'),imgtext:'链接2'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage3.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/sdy.htm'),imgtext:'链接3'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage4.jpg',imgLink:escape('http://onehome.gd.vnet.cn/htmlpages/huapi/index.htm'),imgtext:'链接4'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage5.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/hero1.htm'),imgtext:'链接5'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage6.jpg',imgLink:escape('http://www.gznet.com/telecom/zt/ehome0815/index.html'),imgtext:'链接6'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage7.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/jsyq.htm'),imgtext:'链接7'}");
photoJson.Append("];");
ScriptManager.RegisterStartupScript(this.Page.Header, this.GetType(), "photoJson", photoJson.ToString(), true);
//Response.Write(photoJson.ToString());
}
}
}
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
namespace ImageDemo
{
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
CreatePhotoTran();
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "createPhotoJson", "ImgTran();", true);
}
private void CreatePhotoTran()
{
StringBuilder photoJson = new StringBuilder();
photoJson.Append("imgArr = [");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage1.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/ay_wlan_wxty.htm'),imgtext:'链接1'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage2.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/ehome.htm'),imgtext:'链接2'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage3.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/sdy.htm'),imgtext:'链接3'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage4.jpg',imgLink:escape('http://onehome.gd.vnet.cn/htmlpages/huapi/index.htm'),imgtext:'链接4'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage5.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/hero1.htm'),imgtext:'链接5'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage6.jpg',imgLink:escape('http://www.gznet.com/telecom/zt/ehome0815/index.html'),imgtext:'链接6'},");
photoJson.Append("{imgUrl:'http://www.gd.ehome.cn/EhomeClub/images/TImage7.jpg',imgLink:escape('http://www.gd.ct10000.com/gz/zt/200803S/jsyq.htm'),imgtext:'链接7'}");
photoJson.Append("];");
ScriptManager.RegisterStartupScript(this.Page.Header, this.GetType(), "photoJson", photoJson.ToString(), true);
//Response.Write(photoJson.ToString());
}
}
}