javascript - 在弹出的 html/js 中添加一个按钮
解决方案
你可以发布你的代码吗?至少是html代码。这应该在弹出窗口中添加按钮。
这类似于我认为您在图像中显示的内容。它被称为来自https://www.w3schools.com/css/css_tooltip.asp的工具提示。我添加了按钮的代码。没有您的代码,我们无法确切知道您在寻找什么。
<!DOCTYPE html>
<html>
<style>
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
/* Position the tooltip */
position: absolute;
z-index: 1;
bottom: 100%;
left: 50%;
margin-left: -60px;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
</style>
<body style="text-align:center;">
<h2>Top Tooltip</h2>
<p>Move the mouse over the text below:</p>
<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
<button onclick="myFunction()">Click me</button>
</div>
</body>
</html>
你的 JavaScript:
function myFunction{
alert("Add your code here");
}
推荐阅读
- c# - 为什么我的窗口在加载图像时会改变大小?
- python - 在硬件受限的设备上安装 PyTorch
- css - 在相对元素上方或下方动态定位下拉菜单以适应屏幕取决于滚动位置
- google-drive-api - 通过 Google Drive API 获取文件的视频比特率
- c# - 将复杂的 jquery 选择器与 PuppeteerSharp 一起使用
- android - 如何在没有意图的情况下向日历添加多个事件 Android 8 或 >?
- r - 参数中有变量名的函数
- ruby-on-rails - rails - 设计强参数总是不允许注册
- javascript - 从赛普拉斯的命令日志中获取值
- node.js - 即使我有服务器成员意图,成员缓存也只有我和一个机器人