Page HTML:
<div> <div id= "imgshows" runat= "Server" style= "padding-bottom:10px;" > <div id= "demo" style= "Overflow:hidden; width:100%;
height:190px "> <table cellspacing=" 0 "cellpadding=" 0 "align=" left "border=" 0 "cellspace=" 0 "> <tr> <td id= "Demo1" valign= "Top" runat= "Server" > </t
d> <td id= "Demo2" valign= "Top" > </td> </tr>
</table> </div> <script type= "Text/javascript" >
var speed = Ten var demo = document.getElementById ("demo");
var demo1 = document.getElementById ("Demo1");
var Demo2 = document.getElementById ("Demo2"); demo2.innerhtml = demo1.innerhtml function Marquee () {if (Demo2.offsetwidth-demo.scro LlleFT <= 0) demo.scrollleft-= Demo1.offsetwidth else {DEMO.SCR ollleft++}} var MyMar = SetInterval (Marquee, Speed) de Mo.onmouseover = function () {clearinterval (MyMar)} demo.onmouseout = function () {MyMar = SetInterval ( Marquee, Speed)} </script> </div> </div>
CS Background Code:
private void Bindpics (int comid)
{
list<model.pic> Pic = DAO. Picdao.getpics (comid);
StringBuilder sb = new StringBuilder ();
if (pic = NULL | | pic. Count < 1)
{
imgshows.innerhtml = string. Empty;
return;
}
Sb. Append ("<table width=\" 100%\ "border=\" 0\ "align=\" Center\ "cellpadding=\" 0\ "cellspacing=\" 10px\ "><tr> ");
for (int i = 0; I < pic. Count; i++)
{
Model.pic p = pic[i];
Sb. Append ("<td width=\" 200\ "><a href=\" "+ p.href +" \ "></a></td>");
}
Sb. Append ("</tr></table>");
Demo1. InnerHtml = sb. ToString ();
}
Database tables:
Use [Enterprise]
go
/****** object: Table [dbo].[ Pics] Script Date: 03/17/2011 19:26:27 ******/
SET ansi_nulls on
go
set QUOTED_IDENTIFIER in
go
set Ansi_padding on
go
CREATE TABLE [dbo].[ Pics] (
[Id] [int] IDENTITY (1,1) not NULL,
[COMID] [int] NOT NULL,
[Title] [varchar] (COLLATE) Prc_ci_as null,
[HREF] [varchar] (255) COLLATE chinese_prc_ci_as NULL,
[SRC] [varchar] (255) COLLATE Chinese_ Prc_ci_as not NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
) with (Ignore_dup_key = out) on [PRIMARY]
On [PRIMARY] go
SET ansi_padding off
Entity classes:
public class Pic
{public
int Id {set; get;}
public int Comid {set; get;}
Public Model.companymodel Companymodel {set; get;}
public string Title {set;
public string SRC {set;
public string Href {set; get;}
}
Above this JavaScript to achieve a simple example of the effect of a happy lantern is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.