[英]Confirmation Dialog with Link in message?
抱歉,这是一个愚蠢的问题(我对Web开发还是很陌生),但是在基本的确认对话框消息中是否可以有链接?
现在,我有一个基本的确认弹出窗口
if (confirm("Bunch of text here"))
...
但是客户希望我在该确认框中添加一个链接,该链接将在新窗口中打开。 在邮件中添加html标签不起作用,因为它是邮件字符串。
任何建议,将不胜感激。
谢谢!
您可以制作一个模态并像这样显示它,或者甚至更简单些,使用bootstrap内置的模态。
HTML:
<div class="button">Click</div>
<div class="overlay">
<div class="modal"></div>
</div>
CSS:
.button {
background-color: #aa0000;
color: #fff;
padding: 5px 40px;
display: inline-block;
cursor: pointer;
}
.overlay {
background-color: rgba(0, 0, 0, 0.8);
position: fixed;
height: 100%;
width: 100%;
display: none;
top: 0;
left: 0;
}
.modal {
left: 50%;
margin-left: -100px;
top: 50%;
margin-top: -100px;
background-color: #fff;
position: fixed;
height: 200px;
width: 200px;
}
JS:
$(function() {
var button = $('.button'),
overlay = $('.overlay'),
message = 'Message text',
modal = $('.modal');
button.on('click', function() {
overlay.css('display', 'block');
modal.html( message + '<a href="http://google.com"' + 'target="_blank">' + 'link' + '</a>');
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.