如何将背景音乐添加到网页? [英] how to add background music to a web page?

查看:163
本文介绍了如何将背景音乐添加到网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何添加背景音乐网页?这样当访问者打开页面时,将音乐自动播放。

How do I add background music to a web page? So that when the visitor opens the page, the music will auto play.

我曾尝试<对象> <嵌入> < BGSOUND&GT ; ,但它们都没有在Firefox工作。为什么呢?

I have tried <object> <embed> and <bgsound> but they are all not working in firefox. Why?

推荐答案

&LT; BGSOUND&GT; 标签是Internet Explorer的特定的,因此将不会在其他浏览器如火狐。在&LT;&嵌入GT; 标记应该在FireFox中工作,如果你正确地使用它。它将使用一个浏览器插件来播放声音。下面是一个例子:

The <bgsound> tag is Internet Explorer-specific and will thus not work in other browsers such as FireFox. The <embed> tag should work in FireFox if you use it correctly. It will use a browser plug-in to play the sound. Below is an example:

<embed loop="true" src="sound.wav" hidden="true" type="video/quicktime"></embed>


  • 循环=真指定反复播放声音。

  • SRC =sound.wav指定播放声音文件的相对路径。在多种格式,你可以玩取决于 TYPE = 您指定的内容。

  • 隐藏=真表示不显示媒体播放器的界面。隐藏它,如果你希望用户不能够暂停,停止,或浏览过的声音。

  • TYPE =视频/ QuickTime的指定要使用一个QuickTime组件,这意味着必须安装在客户端的QuickTime。使用应用程序/ x-mplayer2 的Windows Media Player或音频/ X-PN-的RealAudio-插件的Real Player播放音频。的QuickTime播放更多格式,可能是你将要使用什么。

    • loop="true" specifies to play the sound repeatedly.
    • src="sound.wav" specifies the relative path of the sound file to play. The variety of formats you can play depends on what type= you specify.
    • hidden="true" indicates to not show the media player's interface. Hide it if you want the user to not be able to pause, stop, or navigate through the sound.
    • type="video/quicktime" specifies to use a Quicktime component, which means the client must have Quicktime installed. Use application/x-mplayer2 for Windows Media Player or audio/x-pn-realaudio-plugin for Real Player audio. Quicktime plays more formats and is probably what you will want to use.
    • 另外,使用&LT;在一个非常相似的方式;对象&gt。下面是一个例子:

      Alternatively, use <object> in a very similar way. An example is below:

      <object data="sound.wav" type="video/quicktime" width="0" height="0">
          <param name="filename" value="sound.wav">
          <param name="autostart" value="1">
          <param name="playcount" value="true"> 
      </object>
      

      请记住,就像&LT;字幕&GT; 标记,在网页上的背景声音时,因为它往往是突兀和恼人的一般不赞成。此外,作为用户的网页之间进行切换或使后背上,声音会从头开始。只使用音频格式,具有很强的COM pressed,这意味着他们有小的文件大小,或在它下载到客户端机器的声音不会几秒钟播放。

      Keep in mind that, like the <marquee> tag, background sound on a web page is generally frowned upon because it is often obtrusive and annoying. Also, as the user switches between pages or causes post-backs, the sound will restart from the beginning. Only use audio formats that are highly compressed, meaning they have small file sizes, or the sound will not play for several seconds while it downloads to the client machine.

      这篇关于如何将背景音乐添加到网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆