我有一个按钮字段,在它被执行之前有一个警告。该“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?');\">
输出
关于php - 点击警报时闯入内部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34452448/