Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在php中的表中添加onclick事件_Javascript_Php - Fatal编程技术网

Javascript 在php中的表中添加onclick事件

Javascript 在php中的表中添加onclick事件,javascript,php,Javascript,Php,我尝试将这一行添加到我的PHP代码中: <a href="#" onClick="window.open('yourpage.htm','pagename','resizable,height=640,width=360'); return false;">New Page</a> PHP: $html_table .= "<td> <a href="#" onClick="window.open('mypage.htm','pagename','

我尝试将这一行添加到我的PHP代码中:

<a href="#" onClick="window.open('yourpage.htm','pagename','resizable,height=640,width=360'); return false;">New Page</a>

PHP:

$html_table .= "<td> <a href="#" onClick="window.open('mypage.htm','pagename','resizable,height=640,width=360'); return false;"><button type='button' class='btn btn-success'>test</button></a></td>";
$html_table.=”;
但是它与
内部不兼容

更改代码的最佳方法是什么


谢谢

您需要转义引号:

<?php

$html_table .= "<td> <a href=\"#\" onClick=\"window.open('mypage.htm','pagename','resizable,height=640,width=360'); return false;\"><button type='button' class='btn btn-success'>test</button></a></td>";
Great:)很好,谢谢!