public class Temp
{
public int Index { get; set; }
public string Description { get; set; }
public string ImagePath { get; set; }
public DateTime MyDate { get; set; }
}
//数据源
List<Temp> listTemp = new List<Temp>()
{
new Temp(){ Index=1,ImagePath="Desert.jpg", Description="图片1",MyDate=DateTime.Now},
new Temp(){Index=2,ImagePath="Chrysanthemum.jpg", Description="图片2",MyDate=DateTime.Now},
new Temp(){Index=3,ImagePath="Penguins.jpg", Description="图片3",MyDate=DateTime.Now},
new Temp(){Index=4,ImagePath="Jellyfish.jpg", Description="图片4",MyDate=DateTime.Now},
new Temp(){Index=5,ImagePath="Tulips.jpg", Description="图片5",MyDate=DateTime.Now}
};
public void ProcessRequest(HttpContext context)
{
string index = context.Request["Index"];
string jsonStr = string.Empty;
foreach (var item in listTemp)
{
if (item.Index.ToString() == index)
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
jsonStr = serializer.Serialize(item); //序列化为json格式
break;
}
}
context.Response.Write(jsonStr);
}
$.getJSON("imageChange.ashx", { Index: i - 1 }, function (result) {
$("#<%=lblDescription.ClientID %>").text(result.Description);
$("#<%=Image1.ClientID %>").attr("src", path + result.ImagePath.substr(result.ImagePath.lastIndexOf('/') + 1));
var d = eval("new " + result.MyDate.replace(/\//g, ""));
$("#<%=lblDate.ClientID %>").text(Todate(d.ToLocalTime().toString()));
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有