Home  >  Article  >  Web Front-end  >  javascript window.confirm confirmation cancel dialog box implementation code summary_javascript skills

javascript window.confirm confirmation cancel dialog box implementation code summary_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:48:541731browse

confirm() method
The confirm() method is used to display a dialog box with the specified message and OK and Cancel buttons.
Description: confirm() returns true if the user clicks the OK button. If the cancel button is clicked, confirm() returns false

A:

Copy code The code is as follows:

Two types:
Copy code The code is as follows:


< ;a href="Delete.aspx" onClick="delete_confirm">Delete

Three types:
Copy Code The code is as follows:

if(window.confirm('Are you sure you want to cancel the transaction?')){
//alert("OK" );
return true;
}else{
//alert("Cancel");
return false;
}

Four kinds:
Copy code The code is as follows:



A simpler method that I often use

, simpler:
Copy the code The code is as follows:


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn