Solved

Using Javascirpt to display an alert and on closig the alert the browser window will also be closed

Posted on 2004-09-02
3
180 Views
Last Modified: 2008-02-26
Hi,

I'm looking for Javascirpt to display an alert on clicking a submit button and on closing the alert window the browser window will also be closed, is this possible or something close??

thx
0
Comment
Question by:sjsharp80
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 36

Expert Comment

by:Zyloch
ID: 11962186
Hi

You would use a window disguised as best as possible to an alert. I'm not sure if IE supports it now, but you can have window.open(URL,name,'width=200,height=200,dependent=yes');

Another option would be to make an in-page <div> that looks like an alert and to disable losing focus from it until the X is closed or something.

Regards,
Zyloch
0
 
LVL 8

Accepted Solution

by:
RozanaZ earned 400 total points
ID: 11962407
MAybe this can help you:
<HTML>
<HEAD>
<TITLE></TITLE>
<script>
function displayAlert()
{
      alert("Submit Form");
      document.forms[0].submit();
      window.close(true);
}
</script>

</HEAD>
<BODY>
<form onSubmit="displayAlert()">
<input type="submit">
</form>
</BODY>
</HTML>
0
 
LVL 15

Expert Comment

by:justinbillig
ID: 11962618
the only problem is if the window is the main window open the browser will prompt the user to close .. they can always just say no
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question