Image window

D

Darrell

I want to have a page that has a lot of thumb nails. I want to be able to
click on a thumb nail and have it open in a window but I don't want a new
window opening every time I click a thumb nail unless the first window
closes it self. In other words I don't want a bunch of windows open.
Is this possible?
 
M

m

Darrell said:
I want to have a page that has a lot of thumb nails. I want to be able to
click on a thumb nail and have it open in a window but I don't want a new
window opening every time I click a thumb nail unless the first window
closes it self. In other words I don't want a bunch of windows open.
Is this possible?

Yes. Don't open a new win in the first place.
It causes accessibility problems.
 
V

Vic Sowers

Darrell said:
I want to have a page that has a lot of thumb nails. I want to be able to
click on a thumb nail and have it open in a window but I don't want a new
window opening every time I click a thumb nail unless the first window
closes it self. In other words I don't want a bunch of windows open.
Is this possible?

Yes. you will need language like this:
==========================
<script language="JavaScript">
var popup=null;
function closePopUp() {
if (popup && !popup.closed) popup.close();
}
function popUp(url) {
url = String(url.href);
if (popup && !popup.closed) popup.open(url,"_self");
else popup = window.open(url,"_blank",<params>);
}
window.onunload = closePopUp;
</script>

<a onclick="popUp(this); return false;" href="FullImage_1.htm">
<img src="Thumbnail_1.gif">
</a>
<a onclick="popUp(this); return false;" href="FullImage_2.htm">
<img src="Thumbnail_2.gif">
</a>
<etc...>
==========================

<params> may be found (for IE) at:

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp
 
M

Michael Wilcox

Darrell said:
In other words I don't want a bunch of windows open.
Is this possible?

You could start by not opening them in the first place. Just link each
thumbnail to the full-size image and the user will figure out the rest.
 
R

rf

[crossposted groups not on my server snipped]
Vic Sowers said:
Yes. you will need language like this:
==========================
<script language="JavaScript">
var popup=null;
function closePopUp() {
if (popup && !popup.closed) popup.close();
}
function popUp(url) {
url = String(url.href);
if (popup && !popup.closed) popup.open(url,"_self");
else popup = window.open(url,"_blank",<params>);
}
window.onunload = closePopUp;
</script>

<a onclick="popUp(this); return false;" href="FullImage_1.htm">
<img src="Thumbnail_1.gif">
</a>
<a onclick="popUp(this); return false;" href="FullImage_2.htm">
<img src="Thumbnail_2.gif">
</a>
<etc...>

What?

If the OP *really* wants to open the images in the same new window surely
<a href="whatever" target="same">...
is enough :)

Cheers
Richard.
 
D

DU

rf said:
[crossposted groups not on my server snipped]
to

new


Yes. you will need language like this:
==========================
<script language="JavaScript">
var popup=null;
function closePopUp() {
if (popup && !popup.closed) popup.close();
}
function popUp(url) {
url = String(url.href);
if (popup && !popup.closed) popup.open(url,"_self");
else popup = window.open(url,"_blank",<params>);
}
window.onunload = closePopUp;
</script>

<a onclick="popUp(this); return false;" href="FullImage_1.htm">
<img src="Thumbnail_1.gif">
</a>
<a onclick="popUp(this); return false;" href="FullImage_2.htm">
<img src="Thumbnail_2.gif">
</a>
<etc...>


What?

If the OP *really* wants to open the images in the same new window surely
<a href="whatever" target="same">...
is enough :)

Cheers
Richard.

Enlarged images usually have different sizes. If you're going to create
a single separate and unique window for all these enlarged images, then
I think you should adjust the window dimensions to the enlarged images'
dimensions. You can not do that with HTML only; you need javascript.

Also, you have the focus problem/burden with re-using the same popup due
to current os windowing management systems: when you click on the
opener's link to load another enlarged image into the popup, the opener
gets the focus and the popup gets behind. This problem can be corrected,
compensated with javascript (focus()).

DU
 
D

DU

Vic said:
Yes. you will need language like this:
==========================
<script language="JavaScript">

Type has superseded language and is both backward and
forward-compatible. So,

var popup=null;
function closePopUp() {
if (popup && !popup.closed) popup.close();
}
function popUp(url) {
url = String(url.href);
if (popup && !popup.closed) popup.open(url,"_self");
else popup = window.open(url,"_blank",<params>);

There are a few issues here.
First off, I wonder why you load an html file into a popup instead of
just the enlarged image.gif. It's faster to load just a .gif instead of
a full document.
Second, ennlarged images usually do not have the same dimensions. So
loading FullImage_2.htm into the dimensions of the popup when
FullImage_1.htm was created and opened will not make sense.
Third, if the popup just lost focus and the user clicks on the thumbnail
link again in the opener, then the popup will be reloaded when just
bringing it in front would be more efficient. To avoid this, you need to
compare the url.href value with a global variable storing the last
loaded enlarged image href value.

}
window.onunload = closePopUp;
</script>

<a onclick="popUp(this); return false;" href="FullImage_1.htm">
<img src="Thumbnail_1.gif">
</a>

Fourth, if javascript is disabled, the enlarged image won't be loaded in
a popup but rather in the same window. That's fine and acceptable with
me. I just thought the OP would want to open it in a secondary window as
well. If that's the case, then

<a onclick="popUp(this); return false;" href="FullImage_1.htm"
target="EnlargedImagePopup" title="Clicking this thumbnail will bring an
enlarged image in a separate window (requested popup)">
<img src="Thumbnail_1.gif">
</a>

An example of how all this could be:
http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/EnlargeThumbnail.html

DU
 
A

Andrew Murray

Darrell said:
I want to have a page that has a lot of thumb nails. I want to be able to
click on a thumb nail and have it open in a window but I don't want a new
window opening every time I click a thumb nail unless the first window
closes it self. In other words I don't want a bunch of windows open.
Is this possible?
javascript could probably close after a certain time has elapsed - or provide a
"close" link on the open page displaying the image(s).

<a href="#" onclick="window.close();">Close window</a>

the above HTML code will put a link on the page and will close down the open
window.
 
L

Leif K-Brooks

Andrew said:
javascript could probably close after a certain time has elapsed - or provide a
"close" link on the open page displaying the image(s).

<a href="#" onclick="window.close();">Close window</a>

the above HTML code will put a link on the page and will close down the open
window.

Is my "X" button broken?
 
J

John Bowling

Type has superseded language and is both backward and
forward-compatible. So,

<script type="text/javascript">

Except:
<script type="text/javascript 1.n"> will not work!
So <script language="JavaScript 1.n"> is still required where defining the
minimum level is required.

I even tried 1.0 and it did not did not run the function in either IE 6 or
Mozilla 1.5
 
M

Mark Parnell

<script type="text/javascript 1.n"> will not work!
So <script language="JavaScript 1.n"> is still required where defining the
minimum level is required.

And which browsers don't support all versions of JavaScript these days
(if they support it at all, of course)?
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top