无刷新浏览相册

主要实现上面的功能

点击右下角的按钮实现图片切换

代码如下

<%@ Page Language="C#" %> <%@ Register src="header.ascx" tagname="header" tagprefix="uc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <mce:script runat="server"><!-- BJProduct Product = new BJProduct(); ArrayList MyArray = new ArrayList(); BJInfo Info = new BJInfo(); protected string Keyword; int ParentID; //总产品数量 int Count = 0; //前一个产品的ID int PurviveID; //下一个产品的ID int NextID; //当前产品ID int id; //最后一个产品的ID int LastID; //父类标题 protected string CateName = ""; //第一涨图片 protected string FirstPic = string.Empty; BJProductCategory Category = new BJProductCategory(); protected int PID; protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(GetType()); id = FormUtil.GetQueryInt("ID"); if (id != int.MinValue) { Product.ID = id; } if (!Page.IsPostBack) { WebManager.GetInfo(Product); ParentID = Product.ParentID; //ViewState["ParentID"] = ParentID.ToString(); HiddenField1.Value=ParentID.ToString(); Category.ID = ParentID; WebManager.GetInfo(Category); CateName = Category.Title; if (id > 0) { ShowCategory(id,ParentID); } ShowTitle(); } } protected string ShowCategory(int rid,int PID) { Product.ParentID = PID; //得出所有的该产品分类的信息 DataTable dt = WebManager.List(Product, "", "[ID],[Title],[PictureUrl]", "&parentid=", "[OrderNo]"); if (dt.Rows.Count > 0) { FirstPic = dt.Rows[0]["PictureUrl"].ToString(); } Category.ID = ParentID; DataTable PDT = WebManager.List(Category, "", "[ParentID]", "&id=", "[OrderNo]"); if (PDT.Rows.Count > 0) { PID = int.Parse(PDT.Rows[0]["ParentID"].ToString()); } if (dt.Rows.Count > 0) { //总记录数 Count = dt.Rows.Count; //将ID插入到Myarray数值中 for (int i = 0; i < dt.Rows.Count; i++) { MyArray.Add(dt.Rows[i][0]); } //找到最后一个产品的ID号 LastID = int.Parse(dt.Rows[Count - 1][0].ToString()); if (MyArray.Contains(rid)) { //得到当前ID的索引号 int aa = MyArray.BinarySearch(rid); //对应该产品分类中第一张图片的ID int Col = int.Parse(MyArray[0].ToString()); // 如果当前ID为第一张图片的话,上一页去掉超链接,变为文本类型 if (Col == rid) { PurviveID = rid; if (dt.Rows.Count > 1) { NextID = int.Parse(MyArray[1].ToString()); } else { NextID = int.Parse(MyArray[0].ToString()); } } //既不是第一张图片ID,也不是最后一张,就把文本类型的Lab去掉 else if (LastID == rid) { PurviveID = int.Parse(MyArray[aa - 1].ToString()); NextID = rid; } // 如果当前ID为最后一张图片的话,下一页去掉超链接,变为文本类型 else { PurviveID = int.Parse(MyArray[aa-1].ToString()); NextID = int.Parse(MyArray[aa + 1].ToString()); } } } return string.Format("{0},{1}", PurviveID, NextID); } public void ShowTitle() { int kid = 1; Info.ID = kid; WebManager.GetInfo(Info); Keyword = Info.Title; } [AjaxPro.AjaxMethod] public string GetPic(int GID) { string Results = string.Empty; Product.ID = GID; WebManager.GetInfo(Product); Results=string.Format("{0},{1}",Product.PictureUrl,ShowCategory(GID,Product.ParentID)); return Results; } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Category.ID=int.Parse(HiddenField1.Value); WebManager.GetInfo(Category); Response.Redirect("zs.aspx?id=" + Category.ParentID); } // --></mce:script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title><%=Keyword %></title> <uc1:header ID="header1" runat="server" /> <mce:script type="text/javascript"><!-- var PurviveID; var NextID; function ShowPre(pid) { ASP.tpxs_aspx.GetPic(pid,callback); } function callback(res) { if(res!=null) { var MyArray=new Array; MyArray=res.value.split(','); var a=MyArray[0]; document.getElementById('img').src=MyArray[0]; PurviveID=MyArray[1]; NextID=MyArray[2]; } } function GetFirst() { document.getElementById('img').src='<%=FirstPic %>'; PurviveID=<%=PurviveID %>; NextID=<%=NextID %>; } // --></mce:script> <mce:script type="text/javascript"><!-- function DrawImage(ImgD,FitWidth,FitHeight) { var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0) { if(image.width/image.height>= FitWidth/FitHeight) { if(image.width>FitWidth) { ImgD.width=FitWidth; ImgD.height=(image.height*FitWidth)/image.width; } else { ImgD.width=image.width; ImgD.height=image.height; } } else { if(image.height>FitHeight) { ImgD.height=FitHeight; ImgD.width=(image.width*FitHeight)/image.height; } else { ImgD.width=image.width; ImgD.height=image.height; } } } } // --></mce:script> <link href="css/style.css" mce_href="css/style.css" rel="stylesheet" type="text/css" /> </head> <body background="images/bg.jpg" onload="GetFirst()"> <form id="form1" runat="server"> <div> <table width="1003" border="0" align="center" cellpadding="0" cellspacing="0" background="images/bg.jpg" > <tr> <td><table width="1003" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="80"></td> </tr> <tr> <td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000"> <tr> <td width="190" height="513" align="left" valign="top" background="images/hw.jpg"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="STYLE2" style="padding-top:20px" mce_style="padding-top:20px"><%=CateName%>(共<%=Count%>张)</td> </tr> </table></td> <td align="center" valign="middle" class="xbk"> <img id="img" src="" width="813" height="410" onload="javascript:DrawImage(this,813,410);" /> </td> </tr> </table></td> </tr> <tr> <td height="60"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="120" align="center"> <asp:ImageButton ID="ImageButton1" ImageUrl="images/kg.png" runat="server" onclick="ImageButton1_Click" /> </td> <td></td> <td width="90"> <img alt="上一张" src="images/qianjin.png" mce_src="images/qianjin.png" onclick='ShowPre(PurviveID)' width="34" height="29" /> </td> <td width="90"> <img alt="下一张" src="images/ht.jpg" mce_src="images/ht.jpg" onclick='ShowPre(NextID)' width="34" height="29"/> </td> </tr> </table></td> </tr> </table></td> </tr> </table> </div> </form> </body> </html>

内容概要:本文介绍了基于贝叶斯优化的CNN-LSTM混合神经网络在时间序列预测中的应用,并提供了完整的Matlab代码实现。该模型结合了卷积神经网络(CNN)在特征提取方面的优势与长短期记忆网络(LSTM)在处理时序依赖问题上的强大能力,形成一种高效的混合预测架构。通过贝叶斯优化算法自动调参,提升了模型的预测精度与泛化能力,适用于风电、光伏、负荷、交通流等多种复杂非线性系统的预测任务。文中还展示了模型训练流程、参数优化机制及实际预测效果分析,突出其在科研与工程应用中的实用性。; 适合人群:具备一定机器学习基基于贝叶斯优化CNN-LSTM混合神经网络预测(Matlab代码实现)础和Matlab编程经验的高校研究生、科研人员及从事预测建模的工程技术人员,尤其适合关注深度学习与智能优化算法结合应用的研究者。; 使用场景及目标:①解决各类时间序列预测问题,如能源出力预测、电力负荷预测、环境数据预测等;②学习如何将CNN-LSTM模型与贝叶斯优化相结合,提升模型性能;③掌握Matlab环境下深度学习模型搭建与超参数自动优化的技术路线。; 阅读建议:建议读者结合提供的Matlab代码进行实践操作,重点关注贝叶斯优化模块与混合神经网络结构的设计逻辑,通过调整数据集和参数加深对模型工作机制的理解,同时可将其框架迁移至其他预测场景中验证效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值