页面后台文件 public partial class w_AjaxImg : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(w_AjaxImg)); } static int index = 0; //放图片的文件夹 string path = "pic/"; static string[] images = new string[]{"1","2","3","4","5","6", "7","8","9"}; //图片后缀为jpg string ention = ".jpg"; [AjaxPro.AjaxMethod] public string GetNextImg() { index++; if (index > images.Length) index = 0; return path + images[index] +ention; } [AjaxPro.AjaxMethod] public string GetPreImg() { index--; if (index < 0) index = 0; return path + images[index] + ention; } } 其中页面和图片的文件在同一文件夹下 页面代码 <head runat="server"> <title>ajaxPro实战例子(图片查看器)</title> <mce:script language="javascript" type="text/javascript"><!-- function GetNextImg() { w_AjaxImg.GetNextImg(callBack); } function GetPreImg() { w_AjaxImg.GetPreImg(callBack); } function callBack(result) { var g = document.getElementById("imgg"); var obj = result.value; fnToggle(); g.src = obj; } var bTranState = 0; function fnToggle() { var g = document.getElementById("imgg"); g.filters[0].Apply(); if (bTranState=='0') { bTranState = 1; } else { bTranState = 0; } g.filters[0].Play();} // --></mce:script> </head> <body> <form id="form1" runat="server"> <div align=center> <img id="imgg" alt="" width="100px" height="100px;" style="filter:progid:DXImageTransform.Microsoft.Barn(orientation=horizontal, motion=out)" mce_style="filter:progid:DXImageTransform.Microsoft.Barn(orientation=horizontal, motion=out)" /> <br /> <a href="#" mce_href="#" οnclick="GetPreImg();">前一幅</a> <a href="#" mce_href="#" οnclick="GetNextImg();">后一幅</a> </div> </form> </body>