我无法使用以下javascript链接调用javascript函数。这里有什么问题请有人帮我。
$buttonMessage = '
<a class="drupalchat-profile-un drupalchat_cng"
href="javascript:void(0)"
onclick="javascript:chatWith('.$pUsername.','.$profile_uid.','.$UserAvatar.','.$onof.')">
</a>';
答案 0 :(得分:3)
您可能有一些JS错误,需要在您的值周围添加单引号:
$buttonMessage = '
<a class="drupalchat-profile-un drupalchat_cng"
href="javascript:void(0)"
onclick="javascript:chatWith(\''.$pUsername.'\',\''.$profile_uid.'\',\''.$UserAvatar.'\',\''.$onof.'\')">
</a>';