Help with Coding
Posted: Thu Nov 03, 2005 3:15 am
I want to make a page with thumbnail images on the side and when clicked to show a larger image in the middle. I have some code here, which I will post below, but I can't get it to work. If I get 1 image combo right, I can do the rest.
For this example, my thumbnail image is l.jpg and my larger image is li.jpg. Any help on where these images should go will be appreciated.
Here is the code, which I think is right.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
html,body {
margin:0;
padding:0;
height:100%;
}
a img {
border:0;
}
#image-col {
width:180px;
height:100%;
overflow:auto;
background-color:#000099;
text-align:center;
float:left;
}
#image-col img {
width:100px;
height:100px;
border:2px solid #000000;
margin-top:20px;
}
#picture-container {
min-height:100%;
text-align:center;
position:relative;
margin-left:180px;
text-align:center;
}
* html #picture-container {
margin-left:177px;
}
</style>
<script type="text/javascript">
<!--
function showImg(image,thealt){
document.getElementById('large-img').src=image;
document.getElementById('large-img').alt=thealt;
}
//-->
</script>
</head>
<body>
<div id="image-col">
<a href="images/li.jpg" onclick="showImg(this.href,'Large Image 1');return false"><img src="images/li.jpg" alt=""></a>
<a href="thumb2.jpg" onclick="showImg(this.href,'Large Image 2');return false"><img src="thumb2.jpg" alt=""></a>
<a href="thumb3.jpg" onclick="showImg(this.href,'Large Image 3');return false"><img src="thumb3.jpg" alt=""></a>
<a href="thumb4.jpg" onclick="showImg(this.href,'Large Image 4');return false"><img src="thumb4.jpg" alt=""></a>
<a href="thumb5.jpg" onclick="showImg(this.href,'Large Image 5');return false"><img src="thumb5.jpg" alt=""></a>
<a href="thumb6.jpg" onclick="showImg(this.href,'Large Image 6');return false"><img src="thumb6.jpg" alt=""></a>
<a href="thumb7.jpg" onclick="showImg(this.href,'Large Image 7');return false"><img src="thumb7.jpg" alt=""></a>
<a href="thumb8.jpg" onclick="showImg(this.href,'Large Image 8');return false"><img src="thumb8.jpg" alt=""></a>
<a href="thumb9.jpg" onclick="showImg(this.href,'Large Image 9');return false"><img src="thumb9.jpg" alt=""></a>
<a href="thumb10.jpg" onclick="showImg(this.href,'Large Image 10');return false"><img src="thumb10.jpg" alt=""></a></div>
<div id="picture-container"><img id="large-img" src="largeimg.jpg" width="400" height="400" alt="Larger Image"></div>
</body>
</html>
For this example, my thumbnail image is l.jpg and my larger image is li.jpg. Any help on where these images should go will be appreciated.
Here is the code, which I think is right.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
html,body {
margin:0;
padding:0;
height:100%;
}
a img {
border:0;
}
#image-col {
width:180px;
height:100%;
overflow:auto;
background-color:#000099;
text-align:center;
float:left;
}
#image-col img {
width:100px;
height:100px;
border:2px solid #000000;
margin-top:20px;
}
#picture-container {
min-height:100%;
text-align:center;
position:relative;
margin-left:180px;
text-align:center;
}
* html #picture-container {
margin-left:177px;
}
</style>
<script type="text/javascript">
<!--
function showImg(image,thealt){
document.getElementById('large-img').src=image;
document.getElementById('large-img').alt=thealt;
}
//-->
</script>
</head>
<body>
<div id="image-col">
<a href="images/li.jpg" onclick="showImg(this.href,'Large Image 1');return false"><img src="images/li.jpg" alt=""></a>
<a href="thumb2.jpg" onclick="showImg(this.href,'Large Image 2');return false"><img src="thumb2.jpg" alt=""></a>
<a href="thumb3.jpg" onclick="showImg(this.href,'Large Image 3');return false"><img src="thumb3.jpg" alt=""></a>
<a href="thumb4.jpg" onclick="showImg(this.href,'Large Image 4');return false"><img src="thumb4.jpg" alt=""></a>
<a href="thumb5.jpg" onclick="showImg(this.href,'Large Image 5');return false"><img src="thumb5.jpg" alt=""></a>
<a href="thumb6.jpg" onclick="showImg(this.href,'Large Image 6');return false"><img src="thumb6.jpg" alt=""></a>
<a href="thumb7.jpg" onclick="showImg(this.href,'Large Image 7');return false"><img src="thumb7.jpg" alt=""></a>
<a href="thumb8.jpg" onclick="showImg(this.href,'Large Image 8');return false"><img src="thumb8.jpg" alt=""></a>
<a href="thumb9.jpg" onclick="showImg(this.href,'Large Image 9');return false"><img src="thumb9.jpg" alt=""></a>
<a href="thumb10.jpg" onclick="showImg(this.href,'Large Image 10');return false"><img src="thumb10.jpg" alt=""></a></div>
<div id="picture-container"><img id="large-img" src="largeimg.jpg" width="400" height="400" alt="Larger Image"></div>
</body>
</html>