【问题标题】:Create a pop up confirmation message button href - Flask JinjaFlask JavaScript js Jinja- 创建弹出确认消息 [已回答]
【发布时间】:2022-10-06 20:05:35
【问题描述】:

需要一种方法将所有这些功能组合成一个

逐个

烧瓶

<a href=\"{{ url_for(\'products.delete\', id=product.cod) }}\" >Delete</a> 

烧瓶按钮

 <input type=\"button\" value=\"Delete\">

JS脚本

<button onclick=\"myFunction()\">Try it</button>

<p id=\"demo\"></p>

<script>
function myFunction() {
  let text;
  if (confirm(\"Press a button!\") == true) {
    text = \"You pressed OK!\";
  } else {
    text = \"You canceled!\";
  }
  document.getElementById(\"demo\").innerHTML = text;
}

需要一个功能来完成所有这些

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如它目前所写的那样,很难准确地说出你在问什么。

标签: javascript flask popup message confirmation


【解决方案1】:

解决方案

<a href="{{ url_for('productos.delete', id=producto.codprod) }}" onclick="return confirm('Are you sure?')">Delete</a>

和按钮样式

选项1

<a
  href="{{ url_for('productos.delete', id=producto.codprod) }}"
  onclick="return confirm('Are you sure?')"
  type="button"
  style="text-decoration: none;
    min-width: 100px; 
    max-height: 30px; 
    background-color: #224a64; 
    color: #fff;
    text-align: center; 
    border-radius: 6px; 
    cursor: pointer; 
    right: 0px;
  "
  >Eliminar
  </a>

选项 2

<a href="{{ url_for('productos.delete', id=producto.codprod) }}" onclick="return confirm('Are you sure?')"><input type="button" value="Eliminar"></a>

【讨论】:

  • 如果我得到支持,我可以更好地记录
  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-20
  • 2021-10-28
  • 1970-01-01
  • 2014-06-28
  • 2021-12-21
相关资源
最近更新 更多