一.静态的
图片渐变轮换效果
图片渐变轮换效果(IE),请等几秒钟看效果
border=0 style=FILTER:blendTrans(duration=2) width=240 height=180>
二.动态的
1..html代码
图片渐变轮换效果
图片渐变轮换效果(IE),请等几秒钟看效果
border=0 style=FILTER:blendTrans(duration=2) width=240 height=180>
2.cs代码
public class ImageChangeFromDB : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
Web Form Designer generated code#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/**////
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
public static string ConnectionString=System.Configuration .ConfigurationSettings .AppSettings[ConnectionString];
GetDataSet#region GetDataSet
public static DataSet GetDataSet(string sql)
{
SqlDataAdapter sda =new SqlDataAdapter(sql,ConnectionString);
DataSet ds=new DataSet();
sda.Fill(ds);
return ds;
}
#endregion
protected string LoadImage()
{
string sql=select * from ImageChange;
DataSet ds=GetDataSet(sql);
string img=;
for(int m=0;m {
img+=var ImgSrc = new Array();;//图片地址
img+=ImgSrc[+m+] = +\+ds.Tables[0].Rows[m][DisplayImage].ToString()+\;;
img+=for (var i=0;i
img+=var ImgAlt = new Array();;//鼠标放上去显示的文字
img+=ImgAlt[+m+] = +\+ds.Tables[0].Rows[m][Description].ToString()+\;;
img+=var ImgHerf = new Array();;//链接
img+=ImgHerf[+m+] = +\+ds.Tables[0].Rows[m][URL].ToString()+\;;
}
return img;
}
}
3.数据库脚本
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ImageChange]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ImageChange]
GO
CREATE TABLE [dbo].[ImageChange] (
[ImageChangeID] [int] NOT NULL ,
[URL] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[Description] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[DisplayImage] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]