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
181 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Suggested Courses

751 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