Changing pictures

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Raymond Dunton

    Changing pictures

    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="descripti on" content="">
    <meta name="keywords" content="">
    <meta name="author" content="rdunto n@netzero.net">
    <meta name="generator " content="AceHTM L 5 Freeware">

    <script language= "Javascript ">

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

    function ViewPhoto(filen ame)
    {
    photo=window.op en(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=ViewPho to("images/DCP_0287.jpg")> <img
    src="smpics\DCP _0287sm.jpg"></a>
    <a href="#" onclick=ViewPho to("images/DCP_0245.jpg")> <img
    src="smpics\DCP _0245sm.jpg"></a>
    <a href="#" onclick=ViewPho to("images/DCP_0289.jpg")> <img
    src="smpics\DCP _0289sm.jpg"></a>
    <a href="#" onclick=ViewPho to("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.
  • Geoff Tucker

    #2
    Re: Changing pictures

    "Grant Wagner" wrote[color=blue]
    > Geoff Tucker wrote:
    >[color=green]
    > > now open new window:
    > >
    > > features ="height=325 , width=475";[/color]
    >
    > The attribute string passed to window.open() should be a[/color]
    comma-delimited[color=blue]
    > list of attributes and should not contain any additional whitespace.[/color]
    Some[color=blue]
    > browsers will ignore the entire attribute argument if there are spaces[/color]
    in[color=blue]
    > it.
    >[/color]

    Noted, thanks.

    To OP:

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

    var photo = null;

    function ViewPhoto(filen ame)
    {
    features = "height=425,wid th=625";

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





    Comment

    Working...