Changing pictures

R

Raymond Dunton

I am new to Javascript programming. I have a page with four small
pictures. I want to click on a picture and have it open up larger in
a popup window.

this is what I am currently using to do this:

<html>
<!-- Generated by AceHTML Freeware http://freeware.acehtml.com -->
<!-- Creation date: 7/24/2003 -->
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title></title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="(e-mail address removed)">
<meta name="generator" content="AceHTML 5 Freeware">

<script language= "Javascript">

features ="height=325, width=475";

function ViewPhoto(filename)
{
photo=window.open(filename, "photos", features);
photo.focus();
}

<!-- hide script from older browsers

// end hiding -->

</script>

</head>
<body onunload=photo.close();>
<P ALIGN="CENTER"><FONT SIZE="4">Click the pictures to make them
larger</font></p><br>
<a href="#" onclick=ViewPhoto("images/DCP_0287.jpg")><img
src="smpics\DCP_0287sm.jpg"></a>
<a href="#" onclick=ViewPhoto("images/DCP_0245.jpg")><img
src="smpics\DCP_0245sm.jpg"></a>
<a href="#" onclick=ViewPhoto("images/DCP_0289.jpg")><img
src="smpics\DCP_0289sm.jpg"></a>
<a href="#" onclick=ViewPhoto("images/DCP_0288.jpg")><img
src="smpics\DCP_0288sm.jpg"></a>
</body>
</html>

What is happening is that the old photo is showing before the new
photo is loaded. What I would like to have happen is to clear the
window of the old photo before the new one loads. Is that possible
with javascript and how would I do that?

this page is located at http://www.freewebs.com/glorybound/test3.htm

Thanks in advance for any help regarding this problem.
 
G

Geoff Tucker

"Grant Wagner" wrote
The attribute string passed to window.open() should be a comma-delimited
list of attributes and should not contain any additional whitespace. Some
browsers will ignore the entire attribute argument if there are spaces in
it.

Noted, thanks.

To OP:

In my previous post, I forgot to initially declare new window variable:

var photo = null;

function ViewPhoto(filename)
{
features = "height=425,width=625";

if(photo != null && !photo.closed)
{
photo.close();
}
photo=window.open(filename, "photos", features);
photo.focus();
}
 

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
474,077
Messages
2,570,569
Members
47,205
Latest member
KelleM857

Latest Threads

Top