Home > Web Front-end > JS Tutorial > How to delete prompt information in javascript

How to delete prompt information in javascript

醉折花枝作酒筹
Release: 2023-01-06 11:16:56
Original
3082 people have browsed it

In js, you can use the confirm method to delete the prompt information. The syntax format is "confirm (text content)". The confirm method is used to display a dialog box with a specified message and OK and Cancel buttons. If the user clicks the OK button, it returns true; if the user clicks the Cancel button, it returns false.

How to delete prompt information in javascript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer. The

function deleteRecord(theId)
{
if(!confirm("您确定要删除该条记录吗?"))
{
return ;
}
document.location.href="delete.do?id="+theId;
}
Copy after login
<a href="javascript:deleteRecord(<bean:write name="news" property="id"/>)">删除</a>
Copy after login

or

<a href="delete.do?id=1" οnclick="return confirm(&#39;确定删除?&#39;);">删除</a>
Copy after login

confirm() method is used to display a dialog box with the specified message and OK and Cancel buttons.

Syntax

confirm(message)
Copy after login

Parameters

message is the plain text (not HTML text) to be displayed in the dialog box that pops up on the window

If the user clicks the OK button, confirm() returns true. If the cancel button is clicked, confirm() returns false.

It will block all user input to the browser until the user clicks the OK button or the Cancel button to close the dialog box. When confirm() is called, execution of the JavaScript code is paused and the next statement is not executed until the user responds.

Tip: The text of the dialog button is immutable, so write your question or message carefully so that it is suitable for answering with confirm and cancel.

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of How to delete prompt information in javascript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template