找到你要的答案

Q:hyper link that shows confirmation msg box

Q:超链接,显示确认味精盒

I want to use a hyperlink that shows a confirmation msg box. It will process it if 'yes' selected otherwise not.

for example...

<a href="delete?id="+12>delete</a>

that shows a msg box for confirmation do you want to delete if yes then it executes the delete servlet otherwise not.

我想使用一个显示消息框的超链接。它会处理它,如果“是”,否则选择。

例如...

<a href="delete?id="+12>delete</a>

显示一个确认消息框你如果是的然后再执行删除servlet不想删除。

answer1: 回答1:

You can try with this simple but very effective solution

<a href="Your link if use click yes" onclick="return confirm('Are you sure?')">Link</a>

This will redirect to the given link if user Confirms.

Here is the jsfiddle you can check it here.

你可以尝试这个简单但非常有效的解决方案

<a href="Your link if use click yes" onclick="return confirm('Are you sure?')">Link</a>

这将重定向到给定的链接,如果用户确认。

这里是JSFiddle你可以检查一下这里。

answer2: 回答2:

why dont you write an onclick method (for the hyperlink in javascript) and request for a confirmation, if yes, redirect else throw some error or do some other action.

你为什么不写一个onclick方法(在JavaScript的链接)和要求进行确认,如果是,将别人扔一些错误或做一些其他的动作。

html  jsp  confirm