相关疑难解决方法(0)

用JavaScript播放声音

无论我做什么,我根本无法让它在Firefox或IE或Chrome中播放声音.

<html>
<head>
<script type="text/javascript">

    function play() 
 {
     var embed = document.createElement('object');

     embed.setAttribute('src', 'c:\\test.wav');
     embed.setAttribute('hidden', true);
     embed.setAttribute('autostart', true);
     embed.setAttribute('enablejavascript', true);

     document.childNodes[0].appendChild(embed);

 }

// -->
</script>
</head>
<body onload="play();">
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

html javascript audio

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

audio ×1

html ×1

javascript ×1