echo "
<tr>
<td><button onclick=\"check(".$user['brandname'].")\">".$user['brandname']."</button></td>
</tr>
";
这是我的代码,发现点击后没反应,是为什么。。。。。
js部分
function check(a){
alert(a);
}

如何在php实现点击实行带有参数的js函数
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- 斯洛文尼亚旅游 2016-11-30 01:33关注
字符串参数要用引号扩起
echo " <tr> <td><button onclick=\"check('".$user['brandname']."')\">".$user['brandname']."</button></td> </tr> ";
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报