解答例

<!DOCTYPE html>
<html lang="ja-JP">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=yes,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.5">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(function(){
	$("img:nth-of-type(1)").click(function(){
		$("img").css("border","none");
		$(this).css("border","3px solid #FF0000");
	});
	$("img:nth-of-type(2)").click(function(){
		$("img").css("border","none");
		$(this).css("border","3px solid #FF0000");
	});
	$("img:nth-of-type(3)").click(function(){
		$("img").css("border","none");
		$(this).css("border","3px solid #FF0000");
	});
	$("img:nth-of-type(4)").click(function(){
		$("img").css("border","none");
		$(this).css("border","3px solid #FF0000");
	});
	$("img:nth-of-type(5)").click(function(){
		$("img").css("border","none");
		$(this).css("border","3px solid #FF0000");
	});
	
	//下の記述でも可
	/*
	var i = 1;
	$("img").each(function(){
		$("img:nth-of-type(" + i + ")").click(function(){
			$("img").css("border","none");
			$(this).css("border","3px solid #FF0000");
		});
		i++;
	});
	*/
});
</script>
</head>
<body>
	<div>
	<h2>サムネイル</h2>
	<img src="img/image1.png">
	<img src="img/image2.png">
	<img src="img/image3.png">
	<img src="img/image4.png">
	<img src="img/image5.png">
	</div>
</body>
</html>

inserted by FC2 system