Iai*_*son 1 javascript php alert echo
我试图在PHP中回应一个javascript警告消息,但我有问题,在PHP的's'中包含警报的's'.
代码看起来像这样>>
onclick="return confirm('Are you sure you want to delete this customer ?')"
Run Code Online (Sandbox Code Playgroud)
如果我使用
echo onclick="return confirm('Are you sure you want to delete this customer ?')"
Run Code Online (Sandbox Code Playgroud)
如果我使用的话,因为额外的's,我在Dreamweaver中遇到错误
echo'onclick ="return confirm("你确定要删除这个客户吗?")"';
我不再在php中出错,但它仍然不起作用,并且生成的html给了我一个重复的属性消息,因为它输出后会产生额外的"".
尝试
echo('onclick="return confirm(\'Are you sure you want to delete this customer ?\')"');
Run Code Online (Sandbox Code Playgroud)