<分区>
标签 javascript html css xhtml
<分区>
Possible Duplicate:
Integrate a mp3 player into a page with no reloading issue
我有一个有 10 个网页的网站,我想在这个网站中插入一首自动播放的歌曲。
但是我希望当我点击这个网站的另一个网页时音乐不会停止。
这是一种不使用 iframe 或 flash 的方法吗?
最佳答案
编辑:我没有完整阅读您的问题。除非您使用框架或 Ajax 进行导航(如在 Gmail 或 New Twitter 中),否则这是不可能的。
<BGSOUND SRC="aladdin.mid" LOOP=10>
<audio autoplay id="bgsound">
<source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.mp4"
type="audio/mp4">
<source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.oga"
type="audio/ogg; codecs=vorbis">
<p>Your user agent does not support the HTML5 Audio element.</p>
</audio>
<button type="button"
onclick="document.getElementById('bgsound').pause();">
Stop background sound
</button>
<p>
You'll probably annoy your readers if you use background sounds in documents.
</p>
关于javascript - 如何在网站中插入音乐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4533874/