繁体中文
设为首页
加入收藏
当前位置:.Net技术首页 >> Asp.Net开发 >> Ajax无刷新实现图片切换特效

Ajax无刷新实现图片切换特效

2007-10-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介:一、AjaxMethod using System; using System.Data; using System.Data.SqlClient; namespace AjaxImage { /**//// /// AjaxMethod 的摘要说明。 /// public class AjaxMethod { public AjaxMethod() { } publi...
关键字:切换 特效 图片 Ajax

一、AjaxMethod

using System;

using System.Data;

using System.Data.SqlClient;

namespace AjaxImage

{

/**////

/// AjaxMethod 的摘要说明。

///

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代码:

onmouseout="this.src=http://edu.itbulo.com/200609/'images/play_bw.gif'">

onmouseout="this.src=http://edu.itbulo.com/200609/'images/pause_bw.gif'">

onmouseout="this.src=http://edu.itbulo.com/200609/'images/prev_bw.gif'">

onmouseout="this.src='images/next_bw.gif'">

三、JavaScript:

四、在主页面的ONLOAD事件里面添加:

onload="PreloadImage('2')"

五、WebConfig添加:

六、数据库脚本:

CREATE TABLE [Photo] (

[id] [int] IDENTITY (1, 1) NOT NULL ,

[photo_title] [varchar] (128) COLLATE Chinese_PRC_CI_AS NULL ,

[photo_description] [text] COLLATE Chinese_PRC_CI_AS NULL ,

[photo_category_id] [int] NULL ,

[photo_path] [varchar] (255) COLLATE Chinese_PRC_CI_AS NULL

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

http://www.cnblogs.com/wander/archive/2006/09/19/508648.html

转自:动态网站制作指南 | www.knowsky.com

责任编辑:admin
相关文章