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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

791 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