如果没有设置图片的相对定位,在计算光标就有点麻烦
imgs.css
img{ position:relative; border:0}
引入空间using System.Runtime.Serialization;
实休类imageinfo.cs
[DataContract] public class ImageInfo { [DataMember] public string name { get; set; } [DataMember] public int value { get; set; } }
引入空间using System.Runtime.Serialization.Json;
获取json数据传
/// <summary>
/// $codebehindclassname$ 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Handler1 : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write(GetImageInfo());
}
private string GetImageInfo()
{
string path = HttpContext.Current.Server.MapPath("image");
string[] files = Directory.GetFiles(path);
JQueryDemo.Data.ImageInfo[] imageinfo = new JQueryDemo.Data.ImageInfo[files.Length];
for (int i = 0; i < files.Length; i++)
{
imageinfo[i] = new JQueryDemo.Data.ImageInfo() { name = files[i].ToString(), value = i };
}
DataContractJsonSerializer json = new DataContractJsonSerializer(imageinfo.GetType());
MemoryStream ms = new MemoryStream();
json.WriteObject(ms, imageinfo);
ms.Position = 0;
StreamReader sr = new StreamReader(ms);
string info = sr.ReadToEnd();
return info;
}
public bool IsReusable
{
get
{
return false;
}
}
}
|