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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now