1、连数据库 图片切换 ASP.NET1.CSS.containerwidth:262px;height:268px;border:1px solid #eee;position:relative;#idPicTextbackground:#eee;line-height:25px;text-align:center;font-weight:bold;width:262px;white-space:nowrap;overflow:hidden;font-size:12px;#idPicText atext-decoration:none;color:#333;display:block;#idPi
2、cList imgcursor:pointer;width:65px;height:50px;filter:alpha(opacity=50);-moz-opacity: .5;opacity: .5;border:0;margin:10px;#idPicList img.onfilter:alpha(opacity=100);-moz-opacity: 1;opacity: 1;#idNum position:absolute; right:5px; bottom:5px;#idNum lifloat: left;list-style:none;color: #fff;text-align:
3、 center;line-height: 16px;width: 16px;height: 16px;font-family: Arial;font-size: 12px;cursor: pointer;margin: 1px;border: 1px solid #707070;background-color: #060a0b;#idNum li.online-height: 18px;width: 18px;height: 18px;font-size: 14px;border: 0;background-color: #ce0609;font-weight: bold;2. JavaSc
4、riptvar isIE = (document.all) ? true : false;var $ = function (id) return “string“ = typeof id ? document.getElementById(id) : id;var Class = create: function() return function() this.initialize.apply(this, arguments); var Extend = function(destination, source) for (var property in source) destinati
5、onproperty = sourceproperty;var Bind = function(object, fun) return function() return fun.apply(object, arguments);var Each = function(list, fun)for (var i = 0, len = list.length; i = this.List.length) this.Index = 0; /如果当前索引不是显示索引就设置显示if(this._onIndex != this.Index) this._onIndex = this.Index; this
6、.Show(this.Listthis.Index); /如果要自动切换if(this.Auto)this._timer = setTimeout(Bind(this, function() this.Index+; this.Start(); ), this.Duration * 4000 + this.Pause);,/显示Show: function(list) if(isIE)/设置变换参数with(this._img.filters.revealTrans)Transition = this.Transition; Duration = this.Duration; apply();
7、 play();this._img.style.visibility = “;/设置图片属性this._img.src = list.img; this._img.alt = list.text;/设置链接!list“url“ ? (this._a.href = list“url“) : this._a.removeAttribute(“href“);/附加函数this.onShow();,/添加变换对象Add: function(sIimg, sText, sUrl) this.List.push( img: sIimg, text: sText, url: sUrl );,/停止Stop:
8、 function() clearTimeout(this._timer);3, BODYvar rvt = new RevealTrans(“idPicShow“);var imag=new Array();var link=new Array();var text=new Array();var alt = new Array();/获取后台 cs 代码的属性imgUrls=“;imgtexts=“;imgLinks=“;imgAlts=“;imag=imgUrls.split(“,“);text=imgtexts.split(“,“);link=imgLinks.split(“,“);a
9、lt=imgAlts.split(“,“);/添加变换对象for(var i=0;i“ + list.text + “ : list.text;/文本显示区域oText.onmouseover = function() rvt.Auto = false; rvt.Stop(); ;oText.onmouseout = function() rvt.Auto = true; rvt.Start(); ;rvt.Start();4.aspx.cspublic string imgtext = “, imgUrl = “, imgLink = “,imgAlt = “;protected void
10、Page_Load(object sender, EventArgs e)if (!Page.IsPostBack)bind();void bind()using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings“connstr“.ConnectionString)SqlDataAdapter sda = new SqlDataAdapter(“SELECT top 4 * from Player where PlayerState=0 order by PlayerCoun
11、t desc“, connection);DataSet ds = new DataSet();DataTable dt = new DataTable();DataSet uds = new DataSet();DataTable udt = new DataTable();sda.Fill(ds);dt = ds.Tables0;for (int i = 0; i ds.Tables0.Rows.Count; i+)string upFiURL = dt.Rowsi“UpFiID“.ToString();trystring upFiID = upFiURL.Substring(0, upF
12、iURL.IndexOf(“,“);SqlDataAdapter uda = new SqlDataAdapter(“select * from UpFile where UpFiID=“ + upFiID, connection);uda.Fill(uds);udt = uds.Tables0;imgUrl += udt.Rowsi“UpFiURL“.ToString() + “,“;imgtext += dt.Rowsi“PlayerNum“.ToString() + “,“;imgLink += “Player.aspx?ID=“ + dt.Rowsi“PlayerNum“.ToString() + “,“;imgAlt += dt.Rowsi“PlayerName“.ToString() + “,“;catch (Exception)