471,054 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,054 software developers and data experts.

Advanced POP Up Window Functions - Is this possible ?

Hi,

I want to create a popup window that opens when the index.htm page
loads..

Within the popup window, I want to create a link to 'more info'.

When this link is clicked, I want the content to load in the main
window, not the popup, and I'd like the popup to close !

Can this be done ??

How ? and URLS, or working examples ??

Many Thanks

Tom
Jul 23 '05 #1
3 2898
TomT wrote:
Hi,

I want to create a popup window that opens when the index.htm page
loads..
Stop now. You can't reliably open a popup window onload of a page.
Within the popup window, I want to create a link to 'more info'.
When this link is clicked, I want the content to load in the main
window, not the popup, and I'd like the popup to close !
Then why the popup at all?
And, what happens if they *dont* click the link?
Can this be done ??
Not reliably.
How ? and URLS, or working examples ??
There aren't any.
Many Thanks


Many Welcomes.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #2
> Can this be done ??

Yes, this can be done

in the header of the main html document write the following code:

<SCRIPT LANGUAGE="JavaScript">

window.attachEvent('onload', function() {
window.open("your-url.html","moreinfo", "width=300,height=200");
});

</SCRIPT>

Now in the more-info popup html do the following in the header:

<SCRIPT LANGUAGE="JavaScript">

function moreInfoClicked() {

// address to load
url = 'http://yoursite.com/moreinfo.html';

// check if the opener exists and it isn't closed
if (window.opener && (!window.opener.closed)) {
// its not closed, load the URL in the window
window.opener.location.href=url;
} else {
// if it is closed, open a new window
window.open(url, "_blank", "status=1, menubar=1,"+
"scrollbars=1,resizable=1, toolbar=1,location=1");
}
// close current window
window.close();
}

</SCRIPT>

<A HREF="#" onClick="moreInfoClicked();">more info...</A>

see window.open for more info:
http://msdn.microsoft.com/workshop/a...ods/open_0.asp
Good luck,
Vincent

Jul 23 '05 #3

Thanks..

That seems to work great !

Tom
On Fri, 25 Jun 2004 11:27:40 +0200, Vincent van Beveren
<vi*****@provident.remove.this.nl> wrote:
> Can this be done ??


Yes, this can be done

in the header of the main html document write the following code:

<SCRIPT LANGUAGE="JavaScript">

window.attachEvent('onload', function() {
window.open("your-url.html","moreinfo", "width=300,height=200");
});

</SCRIPT>

Now in the more-info popup html do the following in the header:

<SCRIPT LANGUAGE="JavaScript">

function moreInfoClicked() {

// address to load
url = 'http://yoursite.com/moreinfo.html';

// check if the opener exists and it isn't closed
if (window.opener && (!window.opener.closed)) {
// its not closed, load the URL in the window
window.opener.location.href=url;
} else {
// if it is closed, open a new window
window.open(url, "_blank", "status=1, menubar=1,"+
"scrollbars=1,resizable=1, toolbar=1,location=1");
}
// close current window
window.close();
}

</SCRIPT>

<A HREF="#" onClick="moreInfoClicked();">more info...</A>

see window.open for more info:
http://msdn.microsoft.com/workshop/a...ods/open_0.asp
Good luck,
Vincent


Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by zkvneml | last post: by
9 posts views Thread by Let_Me_Be | last post: by
15 posts views Thread by Nayan | last post: by
11 posts views Thread by sunnyalways4u2000 | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.