php - 点击警报时闯入内部

标签 php onclick

我有一个按钮字段,在它被执行之前有一个警告。该“onclick”警报代码包含一个文本。我无法在文本中刹车。我该如何解决?我找到了 [this question][1] 但我仍然无法解决它。问题是当我点击按钮时什么也没有发生。

echo "<tr><td><strong>
<form action='respondent.php' method='post'>
 <input type='hidden' name='rid' value='".$row['rid']."'>
 <input type='hidden' name='firstname' value='".$row['firstname']."'> 
<a href='respondent.php'><button>".$row['firstname']." ".$row['lastname']."</button></a>

 <input type='submit' name='submit' value='Select'>
 </form>
 </strong></td> 
 
 <td>".$row['email']."</td> 
 <td>".$row['pointsummary']."</td> 
 <td>".$row['datetime']."</td>
 
<td> 
<input type='button' action='deleterespondent.php' value='Delete' 
onclick="return confirm('Are you sure you \n want to delete?');">
</td>
</tr>";

最佳答案

移除 单引号 ' 围绕 \n

代码:

<input type='button' action='deleterespondent.php' value='Delete' 
onclick=\"return confirm('Are you sure you \\n want to delete?');\">

输出

enter image description here

关于php - 点击警报时闯入内部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34452448/

相关文章:

php - 如何获取没有千位分隔符的数字?

php - 如何检查字符串是否完全匹配正则表达式模式?

javascript - 在 jquery 中警报变量时警报返回 url 路径

C# Webbrowser Onclick Javascript 事件处理

javascript - 当包含 &lt;script&gt; 标签时,jQuery.html() 会破坏 IE11 中的 onclick 处理程序

php - 删除语句不删除记录

php - 如何从 php 中检索值?

JavaScript + Drupal

javascript - 如何将参数传递给过滤器方法并使用不同的参数在 React onClick 事件中调用该函数?

javascript - 按钮 onclick 打开 WordPress 短代码