Javascript";onclick";不';t嵌入html&;php

Javascript";onclick";不';t嵌入html&;php,javascript,php,html,Javascript,Php,Html,我有一个javascript的删除链接,他会给出是或否。 但我没有得到任何提示。我可以猜到是从php等中逃离的。是谁在我的代码中设置了停止符?“onclick”使用“'”。并且消息使用“'”。这就是问题所在吗?我该怎么解决呢 PHP/JS echo "<td><a href='time.php?id=".$row['id']."' onclick='return confirm('Are you sure to delete this ?');'><span cla

我有一个javascript的删除链接,他会给出是或否。 但我没有得到任何提示。我可以猜到是从php等中逃离的。是谁在我的代码中设置了停止符?“onclick”使用“'”。并且消息使用“'”。这就是问题所在吗?我该怎么解决呢

PHP/JS

echo "<td><a href='time.php?id=".$row['id']."' onclick='return confirm('Are you sure to delete this ?');'><span class='glyphicon glyphicon-remove text-danger'></span></a></td>";
echo”“;

您没有转义“您确定…”周围的引号。使用
\
将其转义:

echo "<td><a href='time.php?id=".$row['id']."' onclick='return confirm(\"Are you sure to delete this ?\");'><span class='glyphicon glyphicon-remove text-danger'></span></a></td>";
echo”“;
这将输出以下HTML:

<td><a href='time.php?id=XX' onclick='return confirm("Are you sure to delete this ?");'><span class='glyphicon glyphicon-remove text-danger'></span></a></td>

您没有转义“您确定…”周围的引号。使用
\
将其转义:

echo "<td><a href='time.php?id=".$row['id']."' onclick='return confirm(\"Are you sure to delete this ?\");'><span class='glyphicon glyphicon-remove text-danger'></span></a></td>";
echo”“;
这将输出以下HTML:

<td><a href='time.php?id=XX' onclick='return confirm("Are you sure to delete this ?");'><span class='glyphicon glyphicon-remove text-danger'></span></a></td>

您的报价有问题。正确地传递它将解决问题

这样做:

echo "<td><a href='time.php?id=".$row['id']."' onclick='return confirm(\"Are you sure to delete this ?\");'><span class='glyphicon glyphicon-remove text-danger'></span></a></td>";
echo”“;

让我知道,以便进一步查询。

您的报价有问题。正确地传递它将解决问题

这样做:

echo "<td><a href='time.php?id=".$row['id']."' onclick='return confirm(\"Are you sure to delete this ?\");'><span class='glyphicon glyphicon-remove text-danger'></span></a></td>";
echo”“;

让我知道进一步的查询。

试试这个,你忘记在代码中使用
\

echo "<td><a href='time.php?id=".$row['id']."' onclick='return confirm(\"Are you sure to delete this ?\");'><span class='glyphicon glyphicon-remove text-danger'></span></a></td>";
echo”“;

试试这个,你忘了在代码中使用
\

echo "<td><a href='time.php?id=".$row['id']."' onclick='return confirm(\"Are you sure to delete this ?\");'><span class='glyphicon glyphicon-remove text-danger'></span></a></td>";
echo”“;

35分钟前发布的同类问题35分钟前发布的同类问题