centering displyed images from photo gallery thumbnails

C

CG

I've created a photo galley in FrontPage 2002. Is there a way to center the
full size image that is generated after clicking on a thumbnail? Is there a
way to have the background on the generated page displayed in black?
Thanks for your help.
 
T

Trevor Lawrence

This was asked recently but I am not sure whether it was this NG or not

Try this code in the calling file:
<html>
<head>
<title>Test Picture</title>
</head>
<body>
<a href="picture.html?p=images/test image.jpg&c=A test caption">
A test image</a>
</body>
</html>

where this is picture.html:
<html>
<head>
<title>Picture</title>
<script type="text/javascript">
function qsobj(parm) {
var qpairs=[], qvbl=[];
// get url string after '?' and split by "&"
qpairs = location.search.substring(1).split("&");
// if it exists, split qpairs[parm] by "=" into an array
if (qpairs[parm])
qvbl = qpairs[parm].split("=");
// return string after '=' if it exists, else null
return qvbl[1] ? unescape(qvbl[1].replace(/%20|\ +/g," ")) : null;
} // ---- end qsobj() ------------
function getPic() {
document.getElementById("pic").src=qsobj(0);
document.title =
document.getElementById("pic").title =
document.getElementById("cap").value = qsobj(1) ||qsobj(0);
} // ---- end qetPic() ------------
</script>
<style type="text/css">
body {background-color:black;}
div {text-align: center; }
</style>
</head>
<body onload="getPic()">
<div>
<img id="pic"><br>
<input id="cap" type="text">
</div>
</body>
</html>

This is the line in the calling file that sets the image filename and an
optional caption
<a href="picture.html?p=images/test image.jpg&c=A test caption">

The image filename is the string after ?p=
The caption is the string after &c=
If the caption is omitted, e.g. the line is <a
href="picture.html?p=images/test image.jpg">, the filename will be used as
the caption
 

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

Top