Image window

Discussion in 'HTML' started by Darrell, Dec 1, 2003.

  1. Darrell

    Darrell Guest

    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?

    --
    Darrell
    Darrell, Dec 1, 2003
    #1
    1. Advertising

  2. Darrell

    m Guest

    Darrell wrote:

    > 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.
    --
    Cheers, m -- http://www.mbstevens.com/howtothumb/
    m, Dec 1, 2003
    #2
    1. Advertising

  3. Darrell

    Vic Sowers Guest

    "Darrell" <> wrote in message
    news:B8Pyb.23243$...
    > 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?
    >
    > --
    > Darrell
    >
    >


    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
    Vic Sowers, Dec 1, 2003
    #3
  4. Darrell <> wrote:
    > 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.
    --
    Michael Wilcox
    mjwilco at yahoo dot com
    Essential Tools for the Web Developer - http://mikewilcox.t35.com
    Michael Wilcox, Dec 1, 2003
    #4
  5. Darrell

    jake Guest

    In message <bgPyb.23842$>, m
    <> writes
    >Darrell wrote:
    >
    >> 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.


    In what way?

    --
    Jake
    jake, Dec 2, 2003
    #5
  6. Darrell

    rf Guest

    [crossposted groups not on my server snipped]
    "Vic Sowers" <> wrote in message
    news:3fcbc6ec$0$184$-pc.org...
    >
    > "Darrell" <> wrote in message
    > news:B8Pyb.23243$...
    > > 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...>


    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.
    rf, Dec 2, 2003
    #6
  7. Darrell

    DU Guest

    rf wrote:

    > [crossposted groups not on my server snipped]
    > "Vic Sowers" <> wrote in message
    > news:3fcbc6ec$0$184$-pc.org...
    >
    >>"Darrell" <> wrote in message
    >>news:B8Pyb.23243$...
    >>
    >>>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...>

    >
    >
    > 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
    DU, Dec 2, 2003
    #7
  8. Darrell

    DU Guest

    Vic Sowers wrote:
    > "Darrell" <> wrote in message
    > news:B8Pyb.23243$...
    >
    >>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?
    >>
    >>--
    >>Darrell
    >>
    >>

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


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

    <script type="text/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>);


    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
    DU, Dec 2, 2003
    #8
  9. "Darrell" <> wrote in message
    news:B8Pyb.23243$...
    > 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?
    >
    > --
    > Darrell
    >
    > Yes, you can have a pop-up window or whatever to display the image, which using

    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.
    Andrew Murray, Dec 6, 2003
    #9
  10. Andrew Murray wrote:
    > 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?
    Leif K-Brooks, Dec 6, 2003
    #10
  11. Darrell

    John Bowling Guest

    "DU" <> wrote in message
    news:bqgpot$b29$...

    > > <script language="JavaScript">

    >
    > 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





    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.560 / Virus Database: 352 - Release Date: 1/8/2004
    John Bowling, Jan 21, 2004
    #11
  12. Darrell

    Mark Parnell Guest

    On Wed, 21 Jan 2004 11:27:58 -0700, "John Bowling"
    <> declared in
    alt.html,alt.html.dhtml,alt.html.tags:
    > <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)?

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
    Mark Parnell, Jan 21, 2004
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Frank
    Replies:
    1
    Views:
    671
    William Ryan
    Dec 31, 2003
  2. Raj
    Replies:
    3
    Views:
    12,931
    gautamkhosla29
    Jun 11, 2009
  3. Andrew Bewley via DotNetMonster.com

    window to window communication (window.opener)

    Andrew Bewley via DotNetMonster.com, Feb 3, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,044
    Andrew Bewley via DotNetMonster.com
    Feb 3, 2005
  4. Laszlo Zsolt Nagy
    Replies:
    1
    Views:
    1,287
    Kartic
    Jan 26, 2005
  5. Jason Heydasch
    Replies:
    1
    Views:
    288
Loading...

Share This Page