单击链接时显示带有 JavaScript 的确认弹出窗口

Display confirmation popup with JavaScript upon clicking on a link(单击链接时显示带有 JavaScript 的确认弹出窗口)

本文介绍了单击链接时显示带有 JavaScript 的确认弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

How do I make one of those hyperlinks where when you click it, it will display a popup asking "are you sure?"

<INPUT TYPE="Button" NAME="confirm" VALUE="???" onClick="message()">

I already have a message() function working. I just need to know what the input type for a hyperlink would be.

解决方案

<a href="http://somewhere_else" onclick="return confirm()">

When the user clicks the link, the confirm function will be called. If the confirm function returns false, the link traversal is cancelled, if true is returned, the link is traversed.

这篇关于单击链接时显示带有 JavaScript 的确认弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:单击链接时显示带有 JavaScript 的确认弹出窗口

基础教程推荐