⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 media_browsersounds.asp

📁 W3Schools tutorial..web designing
💻 ASP
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>Playing Sounds In The Browser</title>
 
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />

<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />

<link rel="stylesheet" type="text/css" href="../stdtheme.css" />

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</head>
<body>

<a name="top"></a>
<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#808080">
<tr>
<td width="234" valign="top">
<a href="../default.htm"><img src="../images/w3default80.jpg" border="0" alt="W3Schools" /></a>
</td>
<th valign="middle" align="left" class="right">
<script type="text/javascript"><!--
google_ad_client = "pub-3440800076797949";
/*txtimg*/
google_ad_slot = "5330033957";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript" src="../../pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<noscript>
<a href="../default.asp" target="_blank"><img src="../banners/w6.gif" border="0" alt="W3Schools" /></a>
</noscript>

<br /></th>
</tr>
</table>

<table style="margin-left:1px" width="800px" border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="137" class="content" valign="top"><br />
<a class="left" href="../default.asp" target="_top">
<img src="../images/homeicon.gif" border="0" alt="home" /></a>
<a class="left" href="../default.asp" target="_top">
<b>HOME</b></a>
<br /><br />
<b>Media Basic</b><br />
<a class="left" target="_top" href="default.asp" >Media HOME</a><br />
<a class="left" target="_top" href="media_intro.asp" >Media Intro</a><br />
<a class="left" target="_top" href="media_soundformats.asp" >Sound Formats</a><br />
<a class="left" target="_top" href="media_videoformats.asp" >Video Formats</a><br />
<a class="left" target="_top" href="media_browsersounds.asp" style='font-weight:bold;'>Playing Sounds</a><br />
<a class="left" target="_top" href="media_browservideos.asp" >Playing Videos</a><br />
<a class="left" target="_top" href="media_windowsformats.asp" >Windows Formats</a><br />
<br />
<b>Object Element</b><br />
<a class="left" target="_top" href="media_object.asp" >Object Intro</a><br />
<a class="left" target="_top" href="media_quicktime.asp" >Object QuickTime</a><br />
<a class="left" target="_top" href="media_realvideo.asp" >Object RealVideo</a><br />
<br />
<b>References</b><br />
<a class="left" target="_top" href="media_tagref.asp" >Tag Reference</a><br />
<a class="left" target="_top" href="media_playerref.asp" >Media Player Ref</a><br />
<a class="left" target="_top" href="media_mimeref.asp" >MIME Reference</a><br /><br />
<b>Selected Reading</b><br />
<a class="left" target="_top" href="../browsers/browsers_stats.asp">Web Statistics</a><br />
<a class="left" target="_top" href="../site/site_glossary.asp">Web Glossary</a><br />
<a class="left" target="_top" href="../hosting/default.asp">Web Hosting</a><br />
<a class="left" target="_top" href="../quality/default.asp">Web Quality</a><br /><br />
<a class="left" target="_top" href="../forum/default.asp">W3Schools Forum</a><br /><br />
<a class="left" target="_top" href="../about/about_helping.asp">Helping W3Schools</a><br /><br />
<script type="text/javascript"><!--
google_ad_client = "pub-3440800076797949";
/*LeftLinkUnit*/
google_ad_slot = "4854527104";
google_ad_width = 120;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="../../pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
<td valign="top">
<table style="border: 1px solid gray" width="100%" bgcolor="#FFFFFF" border="0" cellpadding="5" cellspacing="0">
<tr>
<td>

<h1>Playing Sounds On The Web</h1>
<a href="media_videoformats.asp"><img border="0" src="../images/btn_previous.gif" width="100" height="20" alt="Previous" /></a>
<a href="media_browservideos.asp"><img border="0" src="../images/btn_next.gif" width="100" height="20" alt="Next" /></a>

<hr />

<p><b>Sounds can be played &quot;inline&quot; or by a &quot;helper&quot;, 
depending on the HTML element you use.</b></p>

<hr />

<h2>Inline Sound</h2>

<p>When sound is included in a web page, or as part of a web page, it is called 
inline sound.</p>

<p>Inline sound can be added to a web page by using the &lt;bgsound&gt; element or the 
&lt;img&gt; element.</p>

<p>If you plan to use inline sounds in your web applications, be aware that many 
people find inline sound annoying. Also note that some users might have turned 
off the inline sound option in their browser.</p>

<p>Our best advice is to include inline sound only in web pages where the user 
expects to hear the sound. An example of this is a page which opens after the 
user has clicked on a link to hear a recording.</p>

<hr />

<h2>Using A Helper (Plug-In)</h2>

<p>A helper application is a program that can be launched by the browser to 
&quot;help&quot; playing sound. Helper applications are also called Plug-Ins.</p>

<p>Helper applications can be launched using the &lt;embed&gt; element, the &lt;applet&gt; 
element, or the &lt;object&gt; element.</p>

<p>One great advantage of using a helper application is that you can let some 
(or all) of the player settings be controlled by the user.</p>

<p>Most helper applications allows manually (or programmed) control over the 
volume settings and play functions like rewind, pause, stop and play.</p>

<hr />

<h2>Using The &lt;bgsound&gt; Element</h2>

<p>Internet Explorer supports an element called &lt;bgsound&gt;.</p>

<p>The purpose of this element is to provide a background sound for a web page:</p>

<table width="100%" border="1" class="ex" cellspacing="0">
  <tr>
    <td>
      <pre>&lt;bgsound src=&quot;beatles.mid&quot; /&gt;</pre>
    </td>
  </tr>
</table>

<p>The code fragment above displays a MIDI file as background music for a web 
page.</p>

<p><a target="_blank" href="tryit.asp@filename=trymedia_soundmidiback">Click here to 
try it yourself</a> </p>

<p>A list of attributes for the &lt;bgsound&gt; element can be found in a later 
chapter of this tutorial.</p>

<p><b>Note:</b> The &lt;bgsound&gt; element is not a standard HTML or XHTML element. 
It is supported by Internet Explorer only.</p>

<hr />

<h2>Using The &lt;img&gt; Element</h2>

<p>Internet Explorer supports the dynsrc attribute in the &lt;img&gt; element.</p>

<p>The purpose of this element is to embed multimedia elements in web page:</p>

<table width="100%" border="1" class="ex" cellspacing="0">
  <tr>
    <td>
      <pre>&lt;img dynsrc=&quot;horse.wav&quot; /&gt;</pre>
    </td>
  </tr>
</table>

<p>The code fragment above displays a WAVE file embedded in a web 
page.</p>

<p><a target="_blank" href="tryit.asp@filename=trymedia_soundwaveimg">Click here to 
try it yourself</a> </p>

<p><b>Note:</b> The dynsrc attribute is not a standard HTML or XHTML attribute. 
It is supported by Internet Explorer only.</p>

<hr />

<h2>Using The &lt;embed&gt; Element</h2>

<p>Internet Explorer and Netscape both support an element called &lt;embed&gt;.</p>

<p>The purpose of this element is to embed multimedia elements in web page:</p>

<table width="100%" border="1" class="ex" cellspacing="0">
  <tr>
    <td>
      <pre>&lt;embed src=&quot;beatles.mid&quot; /&gt;</pre>
    </td>
  </tr>
</table>

<p>The code fragment above displays a MIDI file embedded in a web 
page.</p>

<p><a target="_blank" href="tryit.asp@filename=trymedia_soundmidiembed">Click here to 
try it yourself</a> </p>

<p>A list of attributes for the &lt;embed&gt; element can be found in a later chapter 
of this tutorial.</p>

<p><b>Note:</b> The &lt;embed&gt; element is supported by both Internet Explorer and 
Netscape, but it is not a standard HTML or XHTML element. 
The World Wide Web Consortium (W3C) recommend using the &lt;object&gt; element 
instead.</p>

<hr />

<h2>Using The &lt;object&gt; Element</h2>

<p>Internet Explorer and Netscape both support an HTML element called &lt;object&gt;.</p>

<p>The purpose of this element is to embed multimedia elements in web page:</p>

<table width="100%" border="1" class="ex" cellspacing="0">
  <tr>
    <td>
      <pre>&lt;object
classid=&quot;clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95&quot;&gt;
&lt;param name=&quot;FileName&quot; value=&quot;liar.wav&quot; /&gt;
&lt;/object&gt;</pre>
    </td>
  </tr>
</table>

<p>The code fragment above displays a WAVE file embedded in a web 
page.</p>

<p><a target="_blank" href="tryit.asp@filename=trymedia_soundwaveobject">Click here to 
try it yourself</a> </p>

<p>A list of attributes for the &lt;object&gt; element can be found in a later chapter 
of this tutorial.</p>

<hr />

<h2>Using A Hyperlink</h2>

<p>If a web page includes a hyperlink to a media file, most browsers will use a 
&quot;helper application&quot; to play the file:</p>

<table width="100%" border="1" class="ex" cellspacing="0">
  <tr>
    <td>
      <pre>&lt;a href=&quot;beatles.mid&quot;&gt;
Click here to play the Beatles
&lt;/a&gt;</pre>
    </td>
  </tr>
</table>

<p>The code fragment above displays a link to a MIDI file. If the user clicks on 
the link, the browser will launch a helper application like Windows Media Player 
to play the MIDI file.</p>

<p><a target="_blank" href="tryit.asp@filename=trymedia_soundmidilink">Click here to 
try it yourself</a> </p>

<hr />

<a href="media_videoformats.asp"><img border="0" src="../images/btn_previous.gif" width="100" height="20" alt="Previous" /></a>
<a href="media_browservideos.asp"><img border="0" src="../images/btn_next.gif" width="100" height="20" alt="Next" /></a>

<br />
<hr />

<!-- **** SPOTLIGHTS 1 **** -->

<iframe src="../banners/aspallframe.asp" height="110" width="485"
marginwidth="0" marginheight="0" frameborder="0" scrolling="no">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>
<hr />
<!-- **** SPOTLIGHTS 2 **** -->

<h2><a target="_blank" href="../../www.altova.com/ref/@s=w3s_spotlight&q=xmlspy">
Altova

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -