加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

以flash翻页方式展现图片的实现

发布时间:2020-12-15 18:41:16 所属栏目:百科 来源:网络整理
导读:index.aspx前台:?????? div id="ShowAD" ??????????????????? script type="text/javascript" language="javascript" ??????????????????????? var pic_width=698 //图片宽度 ??????????????????????? var pic_height=184 //图片高度 ?????????????????????

index.aspx前台:??????

<div id="ShowAD">
??????????????????? <script type="text/javascript" language="javascript">
??????????????????????? var pic_width=698 //图片宽度
??????????????????????? var pic_height=184 //图片高度
??????????????????????? var swfpath = 'picviewer.swf' //swf文件路径地址,需要'picviewer.swf文件置于index.aspx文件同一级别目录下?

?????????????????????? ?var swf_height = 184
??????????????????????? var pics='<%=BindADOne() %>';//?得到 var pics='ImageAD/01.jpg|ImageAD/02.jpg|ImageAD/03.jpg|ImageAD/04.jpg';
????????????????????????var links='<%=BindADTwo() %>';??//?得到 var links='Item.aspx?Id=2|Item.aspx?Id=2|Item.aspx?Id=2|Item.aspx?Id=2';?
??????????????????????? document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0" width="'+ pic_width +'" height="'+ swf_height +'">');
??????????????????????? document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+swfpath+'"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
??????????????????????? document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
??????????????????????? document.write('<param name="FlashVars" value="pics='+ pics +'&links='+ links +'&borderwidth='+pic_width+'&borderheight='+pic_height+'">');
??????????????????????? document.write('<embed src="'+swfpath+'" wmode="opaque" FlashVars="pics='+ pics +'&links='+ links +'&borderwidth='+pic_width+'&borderheight='+pic_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ pic_width +'" height="'+ pic_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
??????????????????????? document.write('</object>');
??????????????????? </script>
??????????????? </div>

?

index.aspx后台:??????

public string BindADOne() {

??????? string txtPath = Server.MapPath("App_Data/ad.xml");
??????? string reImage=string.Empty;
??????? XmlDocument doc = new XmlDocument();
??????? doc.Load(txtPath);
??????? XmlNodeList listImage = doc.GetElementsByTagName("Image");

??????? foreach (XmlNode node in listImage) {

??????????? reImage += node.InnerText.ToString() + "|";
???????
??????? }
??????? txtImage = reImage.Substring(0,reImage.LastIndexOf("|"));
??????? return txtImage;
???
??? }
??? public string BindADTwo()
??? {
??????? string txtPath = Server.MapPath("App_Data/ad.xml");
??????? string reLink = string.Empty;
??????? XmlDocument doc = new XmlDocument();
??????? doc.Load(txtPath);
??????? XmlNodeList listLink = doc.GetElementsByTagName("ImageLink");

??????? foreach (XmlNode nodeLink in listLink)
??????? {

??????????? reLink += nodeLink.InnerText + "|";

??????? }
??????? txtLink = reLink.Substring(0,reLink.LastIndexOf("|"));
??????? return txtLink;

??? }

?

App_Data/ad.xml:

<?xml version="1.0" encoding="gb2312"?>
<IndexAd>
<ad>
<Id>1</Id>
<Name>图片1</Name>
<Image>ImageAD/01.jpg</Image>
<ImageLink>Item.aspx?Id=2</ImageLink>
</ad>
<ad>
<Id>2</Id>
<Name>图片2</Name>
<Image>ImageAD/02.jpg</Image>
<ImageLink>Item.aspx?Id=2</ImageLink>
</ad>
<ad>
<Id>3</Id>
<Name>图片3</Name>
<Image>ImageAD/03.jpg</Image>
<ImageLink>Item.aspx?Id=2</ImageLink>
</ad>
<ad>
<Id>4</Id>
<Name>图片4</Name>
<Image>ImageAD/04.jpg</Image>
<ImageLink>Item.aspx?Id=2</ImageLink>
</ad>
</IndexAd>

?

picviewer.swf:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读