网页设计中利用JS控制网页音乐的代码实例(6) <input onclick="document.all.NSOPlay.Volume='0'" type=button value="增大声音"> <input onclick="document.all.NSOPlay.Stop();document.all.NSOPlay.CurrentPosition=0;document.all.NSOPlay.play()" type=button value="回放"> <input onclick="document.all.NSOPlay.Previous()" type=button value="上一首"> <input onclick="document.all.NSOPlay.Next()" type=button value="下一首"> <input onclick="document.all.NSOPlay.FastForward()" type=button value="快进"> </body></html> </textarea></td> </tr> <tr> <td> </td> <td> <p><input type="button" value="运行代码" name="B3" onclick="runCode(document.all.emb);"></p></td> </tr> <tr> <td>可以在网页中控制背景音乐:</td> <td><textarea cols="99" rows="11" name="bg" tabindex="3"><html><body><bgsound src="a.mp3" loop=-1>"BGSOUND" 是用来插入背景音乐,但只适用于 IE,其参数设定不多。如下 <pre><BGSOUND src="your.mid" autostart=true loop=infinite> </pre>src="your.mid" 设定 midi 档案及路径,可以是相对或绝对。 autostart=true 是否在音乐档下载完之后就自动播放。true 是,false 否 (内定值)。 loop=infinite 是否自动反复播放。LOOP=2 表示重复两次,Infinite 表示重复多次。 ■ <EMBED>: EMBED> 是用来插入各种多媒体,格式可以是 Midi、Wav、AIFF、AU 等等,Netscape 及 新版的 IE 都支持。其参数设定较多。如下下 <EMBED src="your.mid" autostart="true" loop="true" hidden="true"> src="your.mid" 设定 midi 档案及路径,可以是相对或绝对。autostart=true 是否在音乐档下载完之后就自动播放。true 是,false 否 (内定值)。 loop="true" 是否自动反复播放。LOOP=2 表示重复两次,true 是, false 否。 HIDDEN="true" 是否完全隐藏控制画面,true 为是,no 为否 (内定)。