Javascript popup window

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

I haven't really played with this one that much so I thought that I would ask here. I have a java pop-up window that is coded like so:

<head>
&lt;script Language="JavaScript"&gt;
<!--
function openWin(URL) {
aWindow=window.open(URL,"Directions","toolbar=no,width=400,height=440,status=no,scrollbars=no,resize=no,menubar=no");
}
//-->
&lt;/script&gt;
</head>
<body>
<A href="javascript:openWin('links.htm');"><IMG src="images/links.gif" border="0" alt="Links" width="130" height="32"></A>
'

Basically just a simple small pop-up window that shows links to other sites. What I am wanting to do is when someone clicks on one of the links on this popup, for it to go to a full size window with scrolling, etc but to use the same window as the popup. Is this possible?

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

When you put in all that scrolling JavaScript -- could you edit it so the lines don't stretch off into the wild beyond?!

Anyway, your answer:

"Basically just a simple small pop-up window that shows links to other sites. What I am wanting to do is when someone clicks on one of the links on this popup, for it to go to a full size window with scrolling, etc but to use the same window as the popup. Is this possible?"

No.

What you need to do is close the pop-up window and open a new window that has all the bits in it. Best to have something like onClick="window.close();" and have target="_blank" in the href or something to that effect. Or you can have it so that the window you opened (little popup) closes while it generates a new popup window, but you will have to set everything to "yes", or it won't be a full new window.

The code you are using isn't as friendly as it could be for those without JavaScript enabled, btw -- zerocattle.com/examples/popUp.html is a finished script based on the tutorials from irt.org (linked within the script as well) if you want to learn more about how to control popup windows et cetera. Maybe you can adapt your script a little based on some of the tips in there?

The irt.org tutorials will also show you how to have the remote open the urls in the MAIN window that opened the remote in the first place. The only problem is that if anyone else has named their window, then your remote will no longer open things in that one browser window, but will spawn new windows.

Smiling Suzanne

mjames's picture

They have: 2,064 posts

Joined: Dec 1999

Quote: Originally posted by Suzanne
When you put in all that scrolling JavaScript -- could you edit it so the lines don't stretch off into the wild beyond?!

Sorry to get a little off subject Smiling, but that's not his fault, that vB code intentionally is supposed to show up exactly as typed, but I do agree it would be nice if there was a way to make it wrap.

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

The only way that I could get it to non wrap would be to put it between a couple of code tags. It was spaced out quite nicely when I pasted it.

Suzanne, I assume by not be as user friendly you are referring to the fact that it doesn't consider whether javascript is enabled or what version of browser. I will change that soon enough. It should work with the onclick window close code. I didn't think of that. Thanks.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.