如何使用JavaScript来控制embed标签中的音频

时间:2013-01-24 09:14:35

标签: javascript html audio

开始&停止&暂停按钮正在工作,但我无法控制音频滚动条 这是我的代码>>>我的代码的目标是在不使用html5

的情况下同时控制两个音频
<HTML>
    <HEAD>
        <SCRIPT LANGUAGE="JavaScript">
            function play() {
                window.document.embeds[0].Play()
                window.document.embeds[1].Play()
            }
            function stop() {
                window.document.embeds[0].Stop()
                window.document.embeds[1].Stop()
            }
            function start() {
                window.document.embeds[0].Rewind()
                window.document.embeds[1].Rewind()
            }
            function forward() {
                window.document.embeds[0].Forward();
                window.document.embeds[1].Forward();
            }
            function forward() {
                window.document.embeds[0].forward();
                window.document.embeds[1].forward();
            }
            function forward() {
                window.document.embeds[0].back();
                window.document.embeds[1].back();
            }
        </SCRIPT>
    </HEAD>
    <BODY onLoad="start()">
    <EMBED SRC="Sound/Egypt.wav" NAME="video" AUTOSTART="false">
        <EMBED SRC= "Sound/Madina.wav" AUTOSTART="false">
            <FORM>
                <INPUT TYPE="BUTTON" VALUE="Reset" onClick="start()">
                <INPUT TYPE="BUTTON" VALUE="Play" onClick="play()">
                <INPUT TYPE="BUTTON" VALUE="Pause" onClick="stop()">
                <INPUT TYPE="BUTTON" VALUE="<<" onClick="forward()">
                <INPUT TYPE="BUTTON" VALUE=">>" onClick="backward()">
            </FORM>
    </BODY>
</HTML>

1 个答案:

答案 0 :(得分:0)

function ScrollSound(time){
    var x = document.getElementById("first");               
    x.SetTime(time+ x.GetTime());
    var y = document.getElementById("second");
    y.SetTime(time+ y.GetTime());
}