Gallery legends

G

George Steward

I have a WebPages which displays 20 thumbnails and, on clicking the
thumbnail, that picture is enlarged to a separate box. That all works all
right but try as I may, I am unable to have the legend/description of the
picture with the picture.
Can anybody help please as I have gone to tilt trying for 2 days.
the solution could be in JavaScript or HTML, I already have the array
selection bit working but cannot display the result.
 
P

Peter

I think this is something along the lines of what you are looking for... You
can tweak it for your own purposes. The initArray function initialises the
array containing the location of the images. The script in the body section
writes out the links. The openImg function gets kicked off after you click
on any of the links. It then opens up a page containing a header the img and
a link to close the popup window. You can make this popup page look like
anything you specify. You will need to have a blank.htm file for the popup
function to load into the page initially otherwise you will see a page not
found error before you see the image come up. Just put the following html
into it "<html></html>" so that it takes the minimum length of time to load.

Peter.
___________________________
<html>
<head>
<title></title>
<script type="text/javascript">
var vntImg = new Array();

function initArray() {
for (var t = 0; t <= 9; t++) {
vntImg[t] = "/Windat/540/0" + String(t) + ".jpg";
}
}

function openImg(t) {
var strText = new String();

strText += "<html>\n";
strText += "<head>\n";
strText += "<title>Image " + String(t) + "</title>\n"
strText += "</head>\n\n";
strText += "<body>\n";
strText += "<center>\n";
strText += "<h1>Image " + String(t) + "</h1>\n";
strText += "<img border=\"0\" src=\"" + vntImg[t] + "\"><br>\n\n"
strText += "<a href="javascript:self.close();">Close this window</a>\n";
strText += "</body>\n";
strText += "</html>\n";

var popup = window.open("blank.htm", "popup",
"left=0,top=0,width=1024,height=730");
with (popup.document) {
open();
write(strText);
close();
}
}
</script>

</head>

<body onLoad="initArray();">

<script type="text/javascript">
for (var t = 1; t <= 9; t++) {
with (document) {
write("<a href=\"javascript:eek:penImg(" + String(t) + ");\">Pic " +
String(t) + "</a><br>\n");
}
}
</script>

</body>
</html>
___________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top