By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,749 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,749 IT Pros & Developers. It's quick & easy.

Gallery legends

P: n/a
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.

Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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:openImg(" + String(t) + ");\">Pic " +
String(t) + "</a><br>\n");
}
}
</script>

</body>
</html>
___________________________

"George Steward" <go*****@clara.net> wrote in message
news:10****************@demeter.uk.clara.net...
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.

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.