3

based on some actions in a page , I want to give an alert message to the user (ie.. your resume has been uploaded.) like that and i want to close that window, when the user clicks okay in that alert box. I want to do this using alert method only instead of confirm method in javascript. why because alert method gives the only option "ok" where as confirm method gives " yes or no" .can anyone help me please.

Manikandan
  • 1,784
  • 7
  • 21
  • 30

1 Answers1

7

Just put the statements one after each other :

alert("ok");
window.close();

EDIT following Ankit's remark to OP : note that if you didn't open the window with Javascript yourself, you may not be authorized to close it depending on the browser.

Laurent S.
  • 6,816
  • 2
  • 28
  • 40