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

2022-01-20 00:00:00 user-interface popup javascript html

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.

相关文章