deadlock Message Board
[ June Full List | Reply ]

Re: Javascript Pop-up Window Code
From Dale on 1 June '01
replying to Javascript Pop-up Window Code posted by Jaime

>Can anyone help me? I have a page, which when on loading also loads a small pop-up window. This pop-up window contains a newsticker, with links to new features/articles on the site. When I click on the links they open in the small pop-up window and as a consequence, you are unable to view most of the new material.
>Is there any way that when you click on the link, the small pop up window closes and the page I am linking to opens in the original (large) window? I know it's possible to close the pop-up when clicking the link, but is it possible to carry out the second part at the same time (or even after a short delay)?
>Would be grateful if someone could direct me to a site which might contain such code, or even suggest the particular command which would carry out this functionality.

Not sure of this will help you but you can have a look at it;
<A TARGET="_blank" HREF=...> opens a new, unnamed window.

<A TARGET="foobar" HREF=...> opens a new window named "foobar", provided that a window or frame by that name does not already exist.

Note that links that open new windows can be annoying to your readers if there is not a good reason (from the reader's perspective) for them.

how to create a link that opens a new window of a specific size?
With HTML, there is no way to control the size (or window decoration, or other features) of a new window. However, in JavaScript you can specify such details when using the function.

Start with a normal HTML link (possibly one that opens in a new window as described in the answer to the previous question). Then use the ONCLICK attribute to open a window with the desired appearance for those readers with JavaScript supported and enabled. The following example specifies a window named "popup" that is 300 pixels by 150 pixels.

<A HREF="foo.html" TARGET="popup" ONCLICK="'foo.html', 'popup', 'width=300,height=150'); return false">View Foo</A>

Used in this manner, JavaScript can specify a new window with the desired appearance, without blocking access when JavaScript is unsupported/disabled.

In addition to the parameters height and width (which take a pixel count as a value), the third argument to the can include the following booloean parameters (which take "yes" or "no" as a value): directories, location, menubar, resizable, scrollbars, status, and toolbar. These boolean parameters control the presence of the corresponding window decorations in the resulting window.


Reply to this message

Required Details
Your name:

Optional Details
Home page title:
Home page URL:
(if you'd like to receive automatic replies by email)

Your Message