我无法使用以下 javascript 链接调用 javascript 函数。这里有什么问题,任何人都可以在这里帮助我。
$buttonMessage = '
<a class="drupalchat-profile-un drupalchat_cng"
href="javascript:void(0)"
onclick="javascript:chatWith('.$pUsername.','.$profile_uid.','.$UserAvatar.','.$onof.')">
</a>';
最佳答案
您可能有一些 JS 错误,并且需要在您的值周围添加单引号:
$buttonMessage = '
<a class="drupalchat-profile-un drupalchat_cng"
href="javascript:void(0)"
onclick="javascript:chatWith(\''.$pUsername.'\',\''.$profile_uid.'\',\''.$UserAvatar.'\',\''.$onof.'\')">
</a>';
关于javascript - 在php中回显javascript函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48499569/