0

for example, I'm running page "login.html", on which there are 2 buttons "yes" and "no", you click "no", the browser will automatically close. I hope to get help from people

1 Answers1

1

Something like the following would work depending on your "input" methods

<input type="button" value="close window" onclick="window.close()"/>

But just to clarify the close method closes only windows opened by JavaScript using the open method. If you attempt to close any other window a confirm message is displayed, asking the user to choose whether the window is to be closed or not for obvious security reasons

Curtis Crewe
  • 4,126
  • 5
  • 26
  • 31
  • thank you for looking at my problem, but the problem is I want to shut down the browser if clicking "cancel" on login. Here is the first part of the code, I want to execute the command to close the browser instead of the "simpleForm.getForm (). Reset ();". So there is no real way: Code : buttons: [{ text: 'OK', handler:loginclick },{ text: 'Cancel', handler: function () { simpleForm.getForm().reset(); } }] }); – user2293157 Apr 26 '13 at 01:10