Son*_*y G -8 javascript php onclick
我在我的网站上使用第三方聊天插件,我只是将其javascript代码放在我的网站上。代码是:
<script type="text/javascript">
var __lc = {};
__lc.license = 1812482;
(function() {
var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
})();
</script>
Run Code Online (Sandbox Code Playgroud)
现在我的网站上有一张图片,我希望有人单击该图片然后打开聊天窗口。如何通过单击该图像来调用此函数。
<img src="click_to_chat.png" onclick=""/>
Run Code Online (Sandbox Code Playgroud)
小智 5
如果有人仍然对此感到疑惑,对我来说,它的工作原理如下:
<button onclick="LC_API.open_chat_window();return false">Open Chat</button>
Run Code Online (Sandbox Code Playgroud)
您需要在使用变量之前加载LiveChat脚本标签 LC_API