Help with Coding
Help with Coding
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>
-
- Posts: 6926
- Joined: Thu Feb 10, 2000 8:00 am
Well, I want a web page with thumbnails on the side and when you click them, you will get that image [only larger] in the middle of the page.
Yes, I have a folder called "X" and an index.html in it with a folder called images within that.
I just can't seem to get it to work. I need some help with where the images should go.
I know that the larger image should be the <a href="etc"> and the img src should be the thumbnail.
But there must be something else that I'm missing cause it doesnt work.
Yes, I have a folder called "X" and an index.html in it with a folder called images within that.
I just can't seem to get it to work. I need some help with where the images should go.
I know that the larger image should be the <a href="etc"> and the img src should be the thumbnail.
But there must be something else that I'm missing cause it doesnt work.
-
- Posts: 6926
- Joined: Thu Feb 10, 2000 8:00 am
-
- Posts: 6926
- Joined: Thu Feb 10, 2000 8:00 am
Sorry, I did have this changed on my test site here. Forgot to change it there.
It doesnt work for me at all. No image for the thumbnail or for the large picture. In fact, when I click where the thumbnail should be, it opens a new window [nothing on it of course].
If you have the time to walk me through it like I was 4, fine and appreciated. If not, I will suffer in silence.
At least until tomorrow. :icon25:
It doesnt work for me at all. No image for the thumbnail or for the large picture. In fact, when I click where the thumbnail should be, it opens a new window [nothing on it of course].
If you have the time to walk me through it like I was 4, fine and appreciated. If not, I will suffer in silence.
At least until tomorrow. :icon25:
AmIdYfReAk wrote:truthfully, it works fine here.. allthough you know that within the Div, you are only poining to the same picture right?
Seriously, you just copied this code and put in a picture and it worked??
What could be on my system or settings that is preventing me from seeing anything? I see the boxes on the left side where the thumbnails should be but there is just the little red X instead of the image. And when I click on one of the thumbnails, it takes me to a new page.......which is just a white page with a red X. It is supposed to open the larger image on the same page.
It is tomorrow

-
- Posts: 6926
- Joined: Thu Feb 10, 2000 8:00 am
i saved the data intoa HTML, made a folder called Temp Saved the html in it, then made a filder called images and placed li.jpg in it, and the site worked when i opened it though internet explorer...
also, if you ARE running it off of your local harddrive, you will get a Security Warning through internet explorer saying that it Blocked Content, you need to right click on the tool bar that drops and Click on allow.

also, if you ARE running it off of your local harddrive, you will get a Security Warning through internet explorer saying that it Blocked Content, you need to right click on the tool bar that drops and Click on allow.

-
- Posts: 6926
- Joined: Thu Feb 10, 2000 8:00 am
OK, I did get the above code to work. I have 2 more questions if you guys would be so kind.
1) Where the larger picture is, I want to make it display a little lower on the page, but I'm not sure what part of the code to change.
2) I want to put a little text under the larger image, but again, I'nm not sure where to put it.
Thanks in advance.
1) Where the larger picture is, I want to make it display a little lower on the page, but I'm not sure what part of the code to change.
2) I want to put a little text under the larger image, but again, I'nm not sure where to put it.
Thanks in advance.