View Full Version : JavaScript Help
kansai
January 14th, 2007, 11:19 PM
Hello guys. I found a gallery script from a tutorial here http://www.alistapart.com/articles/imagegallery
I am able to get the script to work. But my problem is trying to modify it.
I would like to use the script so that I can add another title and a description to the targeted image link. From what I am understanding this script uses the "title attribute" to add a brief description to the correct image. I need to add more details but I am unsure how to do so.
Any help would be greatly appreciated.
bigcy
January 15th, 2007, 06:33 AM
hi
can u paste your code here so its easier to us to understand the problem
regards
kansai
January 15th, 2007, 07:07 AM
Hello bigcy thanks for the reply. The code is the same from the site tutorial. Currently I can only have text with the current image using the "title attribute" but I would like to find away to be able to add a description and subtitle also to the current image being displayed.
Thanks again for any help.
<head>
<script type="text/javascript" language="javascript">
function showPic (whichpic) {
if (document.getElementById) {
document.getElementById('placeholder').src = whichpic.href;
if (whichpic.title) {
document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
} else {
document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
}
return false;
} else {
return true;
}
}
</script>
</head>
<body>
<p id="desc">Choose an image to begin</p>
<img id="placeholder" src="images/blank.gif" alt="" />
<ul>
<li><a onclick="return showPic(this)" href="images/bananas.jpg" title="A bunch of bananas on a table">some bananas</a></li>
<li><a onclick="return showPic(this)" href="images/condiments.jpg" title="Condiments in a Chinese restaurant">two bottles</a></li>
<li><a onclick="return showPic(this)" href="images/shells.jpg" title="Seashells on a table">some shells</a></li>
</ul>
</body>
</html>
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.