【问题标题】:Add a button in a popup html/js [closed]在弹出的html/js中添加一个按钮[关闭]
【发布时间】:2021-09-07 09:35:31
【问题描述】:

大家好,我希望在 html / js 中像这样的弹出式地图框上添加一个按钮,您能帮帮我吗

【问题讨论】:

标签: javascript html button popup mapbox


【解决方案1】:

你能发布你的代码吗?至少是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");
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-04
    • 1970-01-01
    • 2019-11-12
    • 1970-01-01
    相关资源
    最近更新 更多