Mike,
I'll have a look at your page.
Without looking at it, I think what I do may be similar. I do a popup using
window.open('picture.html'). In picture.html, I use JS to determine the
image size and use this to position the window centrally and size it (the
window) to fit the image. This is at
http://tandcl.homemail.com.au/ Click on
either picture on left or right (me or Carole). I actually use the image as
a background image overlaid on a table with rounded corner images in the
cells
However, this is too complex for Chas' simple query. This is why I didn't
post yesterday
Chas, here is the simplified code
This is the calling page
<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>
This is picture .html
<html>
<head>
<title>Picture</title>
<!-- other head stuff in here -->
<script type="text/javascript">
function qsobj(parm) {
var qpairs, qvbl;
// get url string after '?' and split by "&" into an array
qpairs = location.search.substring(1).split("&");
// if qpairs[parm] exists, split by "=" into an array, else return null
if (qpairs[parm]) qvbl = qpairs[parm].split("=");
else return null;
// 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:red;}
div {text-align: center; }
</style>
</head>
<body onload="getPic()">
<!-- other body stuff in here -->
<div>
<img id="pic"><br>
<input id="cap" type="text">
</div>
</body>
</html>
The CSS in picture.html sets a red background and centres the <div> in which
the image is placed. You can change these to suit.
I also added code to place a caption underneath the image, in the <img>
title (when the image is moused over) and in the document title (in the
title bar). This is optional. It can be omitted by using <a
href="picture.html?p=images/test image.jpg"> in which case the image
filename will be used.