Ajax无刷新实现图片切换特效
一、AjaxMethod
using System;
using System.Data;
using System.Data.SqlClient;
namespace AjaxImage
{
/**//// <summary>
/// AjaxMethod 的摘要说明。
/// </summary>
public class AjaxMethod
{
public AjaxMethod()
{
}
public static string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"].ToString();
GetDataSet#region GetDataSet
public static DataSet GetDataSet(string sql)
{
SqlDataAdapter sda = new SqlDataAdapter(sql, ConnectionString);
DataSet ds = new DataSet();
sda.Fill(ds);
if (ds != null)
return ds;
else
return null;
}
#endregion
[AjaxPro.AjaxMethod]
public static DataSet GetPhotoList( int iCategoryID )
{
string sql = "Select id,photo_path FROM Photo where photo_category_id=" + iCategoryID ;
return GetDataSet( sql );
}
[AjaxPro.AjaxMethod]
public static DataSet GetPhotoInfo( int id )
{
string sql = string.Format("SELECT photo_title, photo_description FROM Photo WHERE id = {0}", id);
return GetDataSet( sql );
}
}//end class
}
二、页面HTML代码:
<div id="Layer1" style="Z-INDEX:1; LEFT:104px; WIDTH:501px; POSITION:absolute; TOP:28px; HEIGHT:345px">
<img name="slideShow" src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/061120140349189.gif" width="500" height="300" style="FILTER:revealTrans(duration=2,transition=23)">
</div>
<div id="Layer2" style="Z-INDEX:2; LEFT:490px; WIDTH:112px; POSITION:absolute; TOP:380px; HEIGHT:26px">
<img id="btnPlay" src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/06112014034966390.gif" onclick="slideshow_automatic()" onmouseover="this.src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/06112014035083512.gif""
onmouseout="this.src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/06112014035186814.gif""> <img id="btnPause" src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/06112014035566652.gif" onclick="pauseSlideShow()" onmouseover="this.src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/06112014035592227.gif""
onmouseout="this.src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/06112014035663725.gif""> <img id="btnPrev" src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/06112014035798128.gif" onclick="previous_image()" onmouseover="this.src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/06112014035891115.gif""
onmouseout="this.src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/06112014035953355.gif""> <img id="btnNext" src="http://www.esdn.net.cn/Files/BeyondPic/2006-11/20/06
【相关文章:】
没有相关文章
【发表评论】【打印此文】【关闭窗口】【点击数: 】
