| View previous topic :: View next topic |
| Author |
Message |
Glenn Osborn
Joined: 26 Mar 2005 Posts: 12
|
Posted: Sat Mar 26, 2005 10:59 am popup window persistence |
|
|
|
I need to have the ability to allow more than one popup window appear in order to compare two items of merchandise. The JavaScript I'm using pops up the first window, and I also added code to make successive popups come to the front. But I need to be able to show more than one popup at a time. How do I make it so that each click on an image opens a NEW popup and allow each popup to stay in front of the standard page??
Thanks to whomever can help!
Glenn |
|
degsy

Joined: 23 Feb 2005 Posts: 2440 Location: North East, UK
|
|
Glenn Osborn
Joined: 26 Mar 2005 Posts: 12
|
Posted: Sun Mar 27, 2005 8:57 am |
|
|
|
Thanks, degsy, but I don't think that will solve the problem. The popups already use focus, and they do stay on top. However, when a new popup window is desired, in addition to the one already showing, the content of the new window simply replaces the content of the existing window...thus only one window shows at a time. I need two or more.
I think the problem is with the script that calls the popup, not in the popup itself. The script needs to allow as many popups as desired, rather than just one.
Can you dig it, degsy?
Glenn |
|
degsy

Joined: 23 Feb 2005 Posts: 2440 Location: North East, UK
|
Posted: Sun Mar 27, 2005 9:58 am |
|
|
|
| You need to change the Window Name in the popup code. |
|
Glenn Osborn
Joined: 26 Mar 2005 Posts: 12
|
Posted: Sun Mar 27, 2005 11:11 am |
|
|
|
Do you mean I need a separate piece of JavaScript for each popup?
I don't think that changing the window name once will do anything.
Just in case I've been unclear about this, I'm dealing with an html page that has five small images on it. The page has one section of scrpt in the head that specifies a popup window. The content of that window, however, depends on the code that applies to each image within the body of the page. If you click on image #1, an enlargement of that image appears. If you then click on image #2, the popup window stays where it is but its content is replaced with an enlargement of image #2. I want each click on any image to open a separate popup. And, further, the windows should be offset from each other so that the user can tell that more than one of them is open.
Thanks. |
|
degsy

Joined: 23 Feb 2005 Posts: 2440 Location: North East, UK
|
Posted: Sun Mar 27, 2005 12:27 pm |
|
|
|
With popup windows you can specify the window name, the size and the position.
If you don't want to specify the Window Name everytime then use _blank as the name. |
|
Glenn Osborn
Joined: 26 Mar 2005 Posts: 12
|
Posted: Sun Mar 27, 2005 12:44 pm |
|
|
|
I sense we're getting close here, degsy. Unfortunately, I'm an amateur at JavaScript, so I need a little more help:
First, I'm understanding that you mean to give a diffefent window name to each instance of an image that is to appear in a popup. Here's the code for one of them:
<a href="javascript:open_window('contacts/ob-1a.htm')">
<img border="0" src="contacts/contact1a.jpg" width="70"
height="500"></a>
Where does the windo name go and with what syntax? Please re-write the code above so that I don't have to bug you anymore.
...and thanks, again.
Glenn |
|
degsy

Joined: 23 Feb 2005 Posts: 2440 Location: North East, UK
|
Posted: Sun Mar 27, 2005 12:54 pm |
|
|
|
There should be a open_window() function in your page.
You would change it there
e.g.
window.open(url,'_blank','width=300,height=300') |
|
Glenn Osborn
Joined: 26 Mar 2005 Posts: 12
|
Posted: Sun Mar 27, 2005 1:25 pm |
|
|
|
<SCRIPT>
function open_window(url) {
mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=166,height=625');
}
</SCRIPT> |
|
degsy

Joined: 23 Feb 2005 Posts: 2440 Location: North East, UK
|
Posted: Sun Mar 27, 2005 2:27 pm |
|
|
|
| change win to _blank |
|
Glenn Osborn
Joined: 26 Mar 2005 Posts: 12
|
Posted: Sun Mar 27, 2005 3:06 pm |
|
|
|
Ta Da!!!
Thanks a billion. |
|
Glenn Osborn
Joined: 26 Mar 2005 Posts: 12
|
Posted: Sun Mar 27, 2005 3:41 pm |
|
|
|
Alas, I spoke too soon...
For some reason, the window.focus argument in the popup code doesn't seem to work. As soon as I click back to the opener page, the popup disappears behind the main window. If I click on several images, they're all neatly tiled...but in BACK of the main window. Here's the code, again, that I'm using in the popups:
<SCRIPT TYPE="text/javascript">
<!--
window.focus();
//-->
</SCRIPT>
I need those darn windows to popup in front of the main window and stay there until they're closed!
Thanks... |
|
degsy

Joined: 23 Feb 2005 Posts: 2440 Location: North East, UK
|
Posted: Sun Mar 27, 2005 6:49 pm |
|
|
|
You don't really want to do that as it will annoy users.
At the moment I can think of using a setTimeout script to call the focus. |
|
Glenn Osborn
Joined: 26 Mar 2005 Posts: 12
|
Posted: Sun Mar 27, 2005 7:14 pm |
|
|
|
I want to do it so that my users can compare the close up pictures of the merchandise. "Hmmmm...do I want item A or item D?" Of course they can click away the windows they don't want to see. In other words, your concern for users, while laudable, is misplaced in this instance. Can you provide the code for making all the opened windows stay in front until closed?
Thanks again. |
|
degsy

Joined: 23 Feb 2005 Posts: 2440 Location: North East, UK
|
Posted: Sun Mar 27, 2005 7:21 pm |
|
|
|
| Code: |
| Of course they can click away the windows they don't want to see. |
If you use an onfocus script to keep a window in focus then the user cannot click the window behind, only close it. |
|
|