在网页中播放多首歌曲

发布于 2024-09-01 04:18:17 字数 96 浏览 1 评论 0原文

我正在开发 HTML 和 Javascript 项目,我想为网站添加音乐。

有什么方法可以在要播放的代码中添加多首歌曲吗?无论如何,打开下一页时这首歌还会继续吗?

I'm working on my HTML and Javascript project and I wanted to add music for the website..

Is there any way I can put more than one song in the code to be played? And is there anyway that the song will continue when openning the next page?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

太阳公公是暖光 2024-09-08 04:18:30

这是一个类似问题,其中有一些很好的答案。该问题中的评论也列出了许多重复的问题。其中许多答案都需要 HTML5。还有各种基于 Flash 的答案

如果您希望在打开下一页时继续播放歌曲,则需要使用 frames (简单)或让您的网站完全由 AJAX 驱动(更乏味)。

Here is a similar question with some good answers. The comments in that question list many duplicate questions as well. Many of those answers require HTML5. There are also various Flash-based answers as well.

If you want the song to continue when opening the next page you will need to use frames (easy) or make your website entirely AJAX-driven (more tedious).

初见终念 2024-09-08 04:18:26

如果不使用 Flash,您就必须使用新的 HTML5 技术 ,Firefox 3.5+、Safari 4+、Chrome 3+ 和 Opera 10+ 均支持该技术。这是一个例子:

<audio src="path/to/some/audio.file" autoplay>  
  This is a fall back for old browsers, here you could implement a Flash based audio player
</audio>  

我不确定打开下一页时是否可以继续播放歌曲,也许您可​​以将播放器数据存储在 cookie 中。

Without using Flash, you are bound to a new HTML5 technique <audio/>, which is supported in Firefox 3.5+, Safari 4+, Chrome 3+, and Opera 10+. Here is an example:

<audio src="path/to/some/audio.file" autoplay>  
  This is a fall back for old browsers, here you could implement a Flash based audio player
</audio>  

I'm not sure if it is possible to continue the song when opening the next page, maybe you could store player data in a cookie.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文