473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 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 2957
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Nhmiller | last post by:
This is directly from Access' Help: "About designing a query When you open a query in Design view, or open a form, report, or datasheet and show the Advanced Filter/Sort window (Advanced...
4
by: st_ev_fe | last post by:
Hi people, I've been doing C for about 7 years now. But I'm new to C++. I've decided that C++'s operator overloading could be very handy. I'm writing something much like auto_ptr, except for...
5
by: zkvneml | last post by:
Hi guys, Is there a way to retreave the javascript functions' names on the page? The javascript functions are properties of the global object (window/frame), but I do not know how to collect...
9
by: Let_Me_Be | last post by:
Hi all, I'm developing a small defensive programming toolkit for my own projects. So, here are my questions. 1) Is it possible to move from something like this: SAFECALL(foo();) to __safecall...
2
by: sanscrimson | last post by:
Hi! I just want to ask if it possible to call functions in parent window if the child window is created. Below is sample:...
15
by: Nayan | last post by:
Hi, Can anyone suggest working sample of capturing a window's picture? I tried a few, but couldn't get the image. I don't know why those functions are not getting the image. Note: I want the...
5
by: lilOlMe | last post by:
Hi there! I'm developing some crazy Tab Control in .NET that uses JavaScript. A particular JavaScript method needs to be called during the window.onload event in order to initialize my Tab...
11
by: sunnyalways4u2000 | last post by:
hello sir, Sir will please tell me the exact difference between C and advanced C...what are the extra features or funcions...etc added in this advanced one.
0
by: JOHNSHELL08 | last post by:
Dear sir , I found the window xp advanced.really it's very beautiful look so please give me the knowledge about window xp advanced and also its download link.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.