サムネイルの画像を入れ替えます.

4677 ワード

ウェブサイトの中でよく縮むピクチャーを持って交替する効果を見て、マウスがサムネイルの上に移動する時、拡大してピクチャーを表示することができます.
  これをノックします.
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>

<style>
BODY {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 12px; BACKGROUND: #000; 
	PADDING-BOTTOM: 0px; MARGIN-LEFT: auto; COLOR: #f6f6ee; 
	MARGIN-RIGHT: auto; PADDING-TOP: 0px; FONT-FAMILY:   ; HEIGHT: 490px; TEXT-ALIGN: center
}
A {
	COLOR: #fff; TEXT-DECORATION: none
}
A:hover {
	COLOR: #fff; TEXT-DECORATION: underline
}
.fpic {
	BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; Z-INDEX: 3;  
    BACKGROUND: #000;  BORDER-BOTTOM-WIDTH: 0px; WIDTH: 476px; 
    POSITION: relative; HEIGHT: 330px; BORDER-RIGHT-WIDTH: 0px;BORDER: #dddddd 1px solid;
    text-align:center
}
.bpic {
	FLOAT: left; MARGIN: 0px; WIDTH: 244px; POSITION: relative; HEIGHT: 243px
}
#focpic {
	BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; LEFT: 1px; 
	BORDER-BOTTOM-WIDTH: 0px; POSITION: absolute; TOP: 1px; BORDER-RIGHT-WIDTH: 0px
}
.thubpic {
	PADDING-RIGHT: 0px; PADDING-LEFT: 4px; Z-INDEX: 20; 
	PADDING-BOTTOM: 0px; WIDTH: 63px; CURSOR: pointer; 
	PADDING-TOP: 4px; TOP: 10px; HEIGHT: 49px
}
.thubpiccur {
	PADDING-RIGHT: 0px; PADDING-LEFT: 4px; Z-INDEX: 20; 
	PADDING-BOTTOM: 0px; WIDTH: 63px; CURSOR: pointer;
	PADDING-TOP: 4px; TOP: 10px; HEIGHT: 49px
}

.thubpic IMG {
	BORDER-RIGHT: #666 3px solid; BORDER-TOP: #666 2px solid; 
	BORDER-LEFT: #666 3px solid; WIDTH: 56px;
	BORDER-BOTTOM: #666 2px solid; HEIGHT: 42px
}
.thubpiccur IMG {
	BORDER-RIGHT: #666 3px solid; 
	BORDER-TOP: #666 2px solid; 
	BORDER-LEFT: #666 3px solid; WIDTH: 56px; 
	BORDER-BOTTOM: #666 2px solid; HEIGHT: 42px
}
.thubpiccur IMG {
	BORDER-LEFT-COLOR: #fff; 
	BORDER-BOTTOM-COLOR: #fff; 
	BORDER-TOP-COLOR: #fff; 
	BORDER-RIGHT-COLOR: #fff
}
-->
</style>

<SCRIPT language=javascript type=text/javascript>
var picarry = {};
var ttlarry = {};
picarry[0] = "photo/0.jpg";
ttlarry[0] = "iphone1";
picarry[1] = "photo/1.jpg";
ttlarry[1] = "iphone2";
picarry[2] = "photo/2.jpg";
ttlarry[2] = "iphone3";
picarry[3] = "photo/3.jpg";
ttlarry[3] = "iphone4";

</SCRIPT>


<SCRIPT language=javascript>
var currslid = 0;
var slidint;
function setfoc(id){
    //         .
	document.getElementById("focpic").src = picarry[id];
	currslid = id;
	for(i=0;i<4;i++){
		document.getElementById("tmb"+i).className = "thubpic";
	};
	document.getElementById("tmb"+id).className ="thubpiccur";
//      
	focpic.style.visibility = "hidden";
	if (focpic.style.visibility == "visible") {
		focpic.style.visibility = "hidden";
	}else {
		focpic.style.visibility = "visible";
	}
	stopit();
}

//      
function playnext(){
   //       ,    
	if(currslid==3){
		currslid = 0;
	}
   //     
	else{
		currslid++;
	};
	setfoc(currslid);
	playit();
}
// 4500       
function playit(){
	slidint = setTimeout(playnext,4500);
}
//      
function stopit(){
	clearTimeout(slidint);
}
//       
window.onload = function(){
	playit();
}
</SCRIPT>
</head>
<body>
<center>
<DIV class=fpic>
              <IMG id=focpic style="FILTER: RevealTrans ( duration = 1,transition=23 ); 
                      VISIBILITY:visible; POSITION:absolute" height=300 
                      src="photo/0.jpg" width=400> 
                  <DIV style="MARGIN-LEFT: 402px; WIDTH: 65px">
                     <DIV class=thubpiccur id=tmb0 onmouseover=setfoc(0); onmouseout=playit();>
                          <IMG src="photo/0.jpg"  width=56 height=42 border="0">
                     </DIV>
                     <DIV class=thubpic id=tmb1 onmouseover=setfoc(1); onmouseout=playit();>
                        <IMG height=45  src="photo/1.jpg" width=56>
                     </DIV>
                     <DIV class=thubpic id=tmb2 onmouseover=setfoc(2); onmouseout=playit();>
                     <IMG height=45  src="photo/2.jpg" width=56>
                     </DIV>
                     <DIV class=thubpic id=tmb3 onmouseover=setfoc(3); onmouseout=playit();>
                           <IMG height=45  src="photo/3.jpg" width=56>
                     </DIV>
</DIV>
</center>
</BODY>
</HTML>
完全なケースコード