gpt4 book ai didi

html - 单击类似Facebook的按钮时,是否可以播放音频? (html)

转载 作者:行者123 更新时间:2023-12-02 22:36:28 24 4
gpt4 key购买 nike

我需要创建一个网页作为项目的一部分,并且我想添加一种声音效果,该效果可以在按下Facebook之类的按钮时播放。有什么办法吗?我尝试将onclick="document.getElementById('whisper').play();"添加到它随附的iframe标记中,然后再添加<audio id="whisper" src="whisper.mp3" preload="auto"></audio>,但没有任何结果。这可以与网页上的上一个按钮一起使用,那么我是在做错什么还是应该做其他事情吗?理想情况下,我想使用HTML标记完成此操作,但是javascript也可以。

这是带有iframe标签的整个部分:

<section class="contact">
<header>
<h3>It wouldn't kill you to give us a like on Facebook</h3>
</header>
<p>...Or would it?</p>
<iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2F(**link here**)&width=450&layout=standard&action=like&size=small&show_faces=true&share=true&height=80&appId" width="450" height="80" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allow="encrypted-media"></iframe>

</section>

有一个指向页面的链接。出于隐私原因,我不在这里包括它。

如果我不是很具体和/或没有帮助,我深表歉意;到目前为止,我只有大约3个月的HTML经验:)

最佳答案

以前有一种方法可以在单击“赞”按钮后立即调用一个特定事件,但已过时。因此,无法再检测“赞按钮”命中。

https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/v5.0
(这是edge_create事件)

更多信息:Facebook like callback event using edge.create is not working

关于html - 单击类似Facebook的按钮时,是否可以播放音频? (html),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59061281/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com