473,387 Members | 1,529 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,387 software developers and data experts.

Alert box then close window

Hi,

I'm looking for a way to have a message box pop up as a page is
loaded, then, when the user clicks OK on the message box, for the
window to close.

It will be a popup window, so there won't be any "This webpage is
trying to close this window" errors...

Anyone help me out?

Thanks,

Ben
Jul 23 '05 #1
2 23207
BWGames wrote on 03 mei 2004 in comp.lang.javascript:
I'm looking for a way to have a message box pop up as a page is
loaded, then, when the user clicks OK on the message box, for the
window to close.

It will be a popup window, so there won't be any "This webpage is
trying to close this window" errors...


<script type="text/javascript">
alert("Please click OK to close window");
window.close();
</script>

IE6 tested

= or nicer ============

<body onclick="window.close();"
onload="window.resizeTo(300,200);">
Please click this window anywhere to close
</body>

IE6 tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #2
BWGames wrote:
I'm looking for a way to have a message box pop up as a page is
loaded, then, when the user clicks OK on the message box, for the
window to close.

It will be a popup window, so there won't be any "This webpage is
trying to close this window" errors...


It does not make sense to me to open a window just to get it closed.
FWIW:

if (window.confirm("Close window now?"))
{
window.close();
}

RTFM.
PointedEars
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Simon Fletcher | last post by:
Hello there, I need a "Close Window" script ( onLoad.Close.Window() ), however i need the script so it don't come up with this annoying window: "This window is trying to close" window. Is...
1
by: Ivan Sutton | last post by:
Hi, I'm quite new to Java: I installed a script which opened a window in a predefined format. It works fine! I want to know if it is possible to close that screen with java. (however, the...
1
by: Mark Rigsbee | last post by:
I was wonder if anyone out there could shed some light on a problem I am having. I'm having trouble getting a javascript "window.close()" method to work when running over a shared SSL connection....
6
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the page forcing the download dialog to appear. This...
6
by: clequieu | last post by:
I have created a form. Within the form is a button to close the window on click and to validate as well. The close window works when it is a stand alone, but it does not work when it is embedded...
3
by: mcyi2mr3 | last post by:
Hi all I'm new to javascript and im trying to add a close button function to my certain pages of my site. I use this code: <a href='javascript:window.close();'>Close Window</a> to create a...
1
by: bluer | last post by:
hi, i'm a newbie in java. I'm trying to trace a program in java and thought of using alert inside window.location, I would like to check what the si.getIdea_id_no() value is within the...
4
by: Ubi | last post by:
I have a popup and I would like to capture the close window event. How can I do that in javascript? Daniele
2
by: holmes86 | last post by:
hi,everyone I have a GTK window,when click "close window" ,I want to show a verify dialog that whether verify really quit or not.so I used a MesssageDialog for verify quit.But when I clicked the...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.