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

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
sjsharp80Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
RozanaZConnect With a Mentor Commented:
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
 
ZylochCommented:
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
 
justinbilligCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.