Forum Moderators: open

Message Too Old, No Replies

questions about javascript image gallery. (source included)

seeking help customizing a javascript image gallery

         

yeahuh

1:33 am on Jun 21, 2004 (gmt 0)



Hello,

I have a question regarding some JavaScript I got from a great tutorial at
webreference.com. for the life of me I cant find the link now but it’s a simple JavaScript image gallery. (I would like to credit the author but i have lost the link)

Source and the html call are pasted below.
What im wondering is how I would go about adding some description text below the title.

Can I just add in something along the lines of

if (whichpic.body) {
document.getElementById('body')
.childNodes[0].nodeValue = whichpic.body;
} else {
document.getElementById('body')
.childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
}

and then add
<h1 id="body">&nbsp;</h1></td>

to accomplish this?
Im very new to JavaScript sooooo. Please keep everything dumbed down as much as possible for me lol.

Any help would be MUCH appreciated.

Travis.

*ack! it killed my formatting (

<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>

<table width="513" height="428" border="0">
<tr>
<td align="center" valign="middle"><table width="386" height="500" border="1">
<tr align="center" valign="middle">

<!-- Initaly displayed image / placeholder -->
<td height="356"><p><img src="portfolio/ph.jpg" alt="" width="500" height="300" id="placeholder" /></p>
<br />

<!-- Description will be displayed here -->
<h1 id="desc">&nbsp;</h1></td>
</tr>
<!-- Text links "Title" Value is what will fill Description tag above -->
<tr align="center" valign="middle">
<td><a onclick="return showPic(this)" href="portfolio/imagename.jpg" title="title here">link name here.</a><br />
<a onclick="return showPic(this)" href="portfolio/imagename.jpg" title="title here">link name here.</a><br />
<a onclick="return showPic(this)" href="portfolio/imagename.jpg" title="title here">link name here.</a>
</td>
</tr>
</table></td>
</tr>
</table>

Bernard Marx

8:45 am on Jun 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think so, just as long as
whichpic.body
means something (it doesn't seem to yet!)