![]() |
Alert yes/no (Java)
Как на jave сделать alert с кнопками yes/no. Нужен для подтверждения удаления. При нажатии yes удаление подтверждается, при нажатии no alert пропадает и ничего не происходит
|
На JS - confirm()
|
Confirm
Displays a Confirm dialog box with the specified message and OK and Cancel buttons. Method of Window Syntax confirm("message") Parameters message A string. Description A confirm dialog box looks as follows: Use the confirm method to ask the user to make a decision that requires either an OK or a Cancel. The message argument specifies a message that prompts the user for the decision. The confirm method returns true if the user chooses OK and false if the user chooses Cancel. You cannot specify a title for a confirm dialog box, but you can use the open method to create your own confirm dialog. See open. Examples This example uses the confirm method in the confirmCleanUp function to confirm that the user of an application really wants to quit. If the user chooses OK, the custom cleanUp function closes the application. function confirmCleanUp() { if (confirm("Are you sure you want to quit this application?")) { cleanUp() }} You can call the confirmCleanUp function in the onClick event handler of a form's push button, as shown in the following example: <INPUT TYPE="button" VALUE="Quit" onClick="confirmCleanUp()"> See also Window.alert, Window.prompt |
| Часовой пояс GMT +4, время: 06:39. |
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.