Click to See Complete Forum and Search --> : Need a simple Script...


RTR
10-14-2003, 12:01 PM
I know there's a Script for this but I can't find it. Here's the scenario:

Very simple...
I have a web page running the simple 'window.open' script. Each text link opens a jpg file. Each picture's in its own separate browser (IE6) and is custom sized to fit each pic. And they pop open roughly in the center of the webpage.

Right now, when I click on one link, the picture pops open. If I don't close the pic's browser first, then click on another pic link...the new pic loads in the old pics browser (the wrong size now for the new pic) and minimized so I have to retrieve it from below.

Does anyone here know the snippet of script so that I may just click from one text link to the next and have each picture browser automatically close and the new one open?

I want to click on each pic link, open one pic...then click on the next pic link and have the first pic auto close and the new pic open as usual, and so on and so on.
And so that the new pic opening doesn't minimize itself in the process.

Thanks in advance....

-R

Charles
10-14-2003, 12:08 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>
<ul>
<li><a href="http://www.bettiepage.com/images/photos/bikini/bikini1.jpg" onclick="window.open(this.href, 'bettie1', 'height=300,width=149'); return false">Bettie 1</a></li>
<li><a href="http://www.bettiepage.com/images/photos/bikini/bikini2.jpg" onclick="window.open(this.href, 'bettie2', 'height=300,width=213'); return false">Bettie 2</a></li>
<li><a href="http://www.bettiepage.com/images/photos/bikini/bikini3.jpg" onclick="window.open(this.href, 'bettie3', 'height=300,width=217'); return false">Bettie 3</a></li>
<li><a href="http://www.bettiepage.com/images/photos/bikini/bikini4.jpg" onclick="window.open(this.href, 'bettie4', 'height=300,width=232'); return false">Bettie 4</a></li>
</ul>

RTR
10-14-2003, 12:26 PM
Thank you Charles but there's one small problem still.
Click on Betty1 and she opens. Click on Betty2 and she opens. It looks like Betty1 closes but she's only popping behind in the background where I can't see her. I have to retrieve them and close them all manually.

I'm looking to have the new pic, as it opens, close the old pic.

Thanks....

-R

Charles
10-14-2003, 12:47 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>
<ul>
<li><a href="http://www.bettiepage.com/images/photos/bikini/bikini1.jpg" onclick="if (self.win != undefined && !self.win.closed) self.win.close(); self.win = window.open(this.href, 'bettie1', 'height=300,width=149'); return false">Bettie 1</a></li>
<li><a href="http://www.bettiepage.com/images/photos/bikini/bikini2.jpg" onclick="if (self.win != undefined && !self.win.closed) self.win.close(); self.win = window.open(this.href, 'bettie2', 'height=300,width=213'); return false">Bettie 2</a></li>
<li><a href="http://www.bettiepage.com/images/photos/bikini/bikini3.jpg" onclick="if (self.win != undefined && !self.win.closed) self.win.close(); self.win = window.open(this.href, 'bettie3', 'height=300,width=217'); return false">Bettie 3</a></li>
<li><a href="http://www.bettiepage.com/images/photos/bikini/bikini4.jpg" onclick="if (self.win != undefined && !self.win.closed) self.win.close(); self.win = window.open(this.href, 'bettie4', 'height=300,width=232'); return false">Bettie 4</a></li>
</ul>

RTR
10-14-2003, 06:44 PM
Thank you again Charles. That nailed it.

-R

RTR
10-15-2003, 02:29 PM
The code you posted Charles works beautifully. Thank you again. I ran into a small problem however with a friends computer. He has IE5. When he clicks on the text links, the picture opens for him, but not the way I have it coded to behave.

It should look like this:
BEHAVING (http://home.earthlink.net/~rtrstudio/java1.jpg)
Then the next link you click on closes the previous pic etc.

But on his IE5, it pops open like this:
MIS-BEHAVING (http://home.earthlink.net/~rtrstudio/norm1.jpg)
Thus making him have to hit his Back button (or close the pic to get back to the pic page...don't recall which one).

Is it that I need some snippet of code regarding the accessability of older and or different browsers?

Here's a link to an example page for anyone to view if they wish:
HERE (http://home.earthlink.net/~rtrstudio/example.htm)

Thanx again to any and all....
RAY