How to switch JS images (with thumbnail)

Source: Internet
Author: User

Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<HTML xmlns = "http://www.w3.org/1999/xhtml">

<Head>

<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">

<Title> code for switching between five-screen slides with thumbnails </title>

<Style>

BODY {

FONT-SIZE: 9pt; BACKGROUND: # d8d8d8; MARGIN: 0px auto; COLOR: #505050; FONT-FAMILY:, arial, verdana, sans-serif, fantasy, tahoma; TEXT-DECORATION: none; background1: # c8e4f2

}

A {

TEXT-DECORATION: none

}

A: link {

COLOR: #505050; color1: # 54564c

}

A: visited {

COLOR: #505050; color1: # 54564c

}

A: hover {

COLOR: # d40005; TEXT-DECORATION: underline

}

A: active {

COLOR: # f30

}

IMG {

BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px

}

. Box {

FLOAT: left; WIDTH: 472px

}

. Box. boxpadding {

PADDING-RIGHT: 8px; PADDING-LEFT: 8px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 8px; PADDING-TOP: 8px

}

# Slide {

CLEAR: both; BORDER-RIGHT: # fff 1px solid; BORDER-TOP: # fff 1px solid; MARGIN-BOTTOM: 6px; OVERFLOW: hidden; BORDER-LEFT: # fff 1px solid; WIDTH: pixel PX; BORDER-BOTTOM: # fff 1px solid; HEIGHT: 335px

}

# Slide {

COLOR: #000

}

. Img {

BORDER-RIGHT: # fff 1px solid; BACKGROUND: # fff; MARGIN: 0px auto; BORDER-LEFT: # fff 1px solid; TEXT-ALIGN: center

}

. Boxpadding {

BORDER-RIGHT: # fff 1px solid; BORDER-TOP: # fff 1px solid; BACKGROUND: # f8f8f8; MARGIN-BOTTOM: 8px; BORDER-LEFT: # fff 1px solid; PADDING-TOP: 10px; BORDER-BOTTOM: # fff 1px solid

}

 

. Thumb_title {

MARGIN-TOP: 10px; BACKGROUND: # fff; FILTER: alpha (opacity = 30); WIDTH: pixel; TEXT-INDENT: 10px; LINE-HEIGHT: 25px; POSITION: absolute; HEIGHT: 25px;-moz-opacity: 0.3

}

# Slide_Thumb {

MARGIN-TOP: 257px; MARGIN-LEFT: 0px; POSITION: absolute

}

. Thumb_on {

DISPLAY: inline; FLOAT: left; MARGIN-LEFT: 8px; CURSOR: pointer

}

. Thumb_off {

DISPLAY: inline; FLOAT: left; MARGIN-LEFT: 8px; CURSOR: pointer

}

. Thumb_off {

FILTER: alpha (opacity = 50);-moz-opacity: 0.5

}

. Thumb_on {

FILTER: alpha (opacity = 100);-moz-opacity: 1

}

. Thumb_off IMG {

BORDER-RIGHT: # fff 1px solid; BORDER-TOP: # fff 1px solid; MARGIN-TOP: 12px; BORDER-LEFT: # fff 1px solid; WIDTH: 75px; BORDER-BOTTOM: # fff 1px solid; HEIGHT: 56px

}

. Thumb_on IMG {

BORDER-RIGHT: # fff 1px solid; BORDER-TOP: # fff 1px solid; BORDER-LEFT: # fff 1px solid; WIDTH: 91px; BORDER-BOTTOM: # fff 1px solid; HEIGHT: 68px

}

</Style>

</Head>

<Body>

<Table width = "472" height = "511" border = "0" align = "center" cellpadding = "0" cellspacing = "0">

<Tr>

<Td width = "472"> <div class = box style = "MARGIN-BOTTOM: 8px">

<Div class = boxpadding>

<Div id = Slide> <a id = foclnk

Href = "/" target = _ blank>

Src = "/jscss/demoimg/wall1.jpg" width = "450" height = "335"/> </a>

<Div class = thumb_title id = foctitle> <a href = "/"

Target = _ blank> Figure 1 </a> </div>

<Div id = Slide_Thumb>

<Div class = thumb_on id = tmb0 onmouseover = setfoc (0); onmouseout = playit ();> <

Href = "/" target = _ blank> </a> </div>

<Div class = thumb_off id = tmb1 onmouseover = setfoc (1); onmouseout = playit ();> <

Href = "/" target = _ blank> </a> </div>

<Div class = thumb_off id = tmb2 onmouseover = setfoc (2); onmouseout = playit ();> <

Href = "/" target = _ blank> </a> </div>

<Div class = thumb_off id = tmb3 onmouseover = setfoc (3); onmouseout = playit ();> <

Href = "/" target = _ blank> </a> </div>

<Div class = thumb_off id = tmb4 onmouseover = setfoc (4); onmouseout = playit ();> <

Href = "/" target = _ blank> </a> </div>

<Script language = javascript type = text/javascript>

Var picarry = {};

Var lnkarry = {};

Var ttlarry = {};

Picarry [0] = "http://www.codefans.net/jscss/demoimg/wall1.jpg ";

Lnkarry [0] = "/";

Ttlarry [0] = "Figure 1 ";

Picarry [1] = "/jscss/demoimg/wall2.jpg ";

Lnkarry [1] = "/";

Ttlarry [1] = "Figure 2 ";

Picarry [2] = "/jscss/demoimg/wall3.jpg ";

Lnkarry [2] = "/";

Ttlarry [2] = "Figure 3 ";

Picarry [3] = "/jscss/demoimg/wall4.jpg ";

Lnkarry [3] = "/";

Ttlarry [3] = "Figure 4 ";

Picarry [4] = "/jscss/demoimg/wall5.jpg ";

Lnkarry [4] = "/";

Ttlarry [4] = "Figure 5 ";

</Script>

</Div>

</Div>

</Div>

</Div> </td>

</Tr>

</Table>

<Div align = "center">

<SCRIPT type = text/javascript>

Var currslid = 0;

Var s0000int;

Function setfoc (id ){

Document. getElementById ("focpic"). src = picarry [id];

Document. getElementById ("foclnk"). href = lnkarry [id];

Document. getElementById ("foctitle "). innerHTML = '<a href = "' + lnkarry [id] + '" target = "_ blank">' + ttlarry [id] + '</a> ';

Currslid = id;

For (I = 0; I <5; I ++ ){

Document. getElementById ("tmb" + I). className = "thumb_off ";

};

Document. getElementById ("tmb" + id). className = "thumb_on ";

Focpic. style. visibility = "hidden ";

Focpic. filters [0]. Apply ();

If (focpic. style. visibility = "visible "){

Focpic. style. visibility = "hidden ";

Focpic. filters. revealTrans. transition = 23;

}

Else {

Focpic. style. visibility = "visible ";

Focpic. filters [0]. transition = 23;

}

Focpic. filters [0]. Play ();

Stopit ();

}

 

Function playnext (){

If (currslid = 4 ){

Currslid = 0;

}

Else {

Currslid ++;

};

Setfoc (currslid );

Playit ();

}

Function playit (){

S0000int = setTimeout (playnext, 4500 );

}

Function stopit (){

ClearTimeout (s0000int );

}

Window. onload = function (){

Playit ();

} </SCRIPT>

</Div>

</Body>

</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.