你好,我在客户端编程和html方面有点新手,我正在尝试在firefox和其他浏览器中执行以下代码,代码应该播放声音,问题是代码可以在IE和Chrome上播放声音,但不是在firefox上。这是我的代码:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Untitled 1</title>
<script type="text/javascript">
function playsound()
{
var sound= document.getElementById("check");
sound.play();
}
</script>
</head>
<body>
<audio id = "check" preload = "auto">
<source src = "check.mp3" type = "audio/mpeg"></audio>
<input type="button" onclick="playsound()" value="play">
发布于 2012-04-20 14:25:26
火狐不支持MP3格式作为音频源。如果你添加了另一个OGG格式的源文件,这个脚本应该也能在Firefox中工作。See this Link for more info
https://stackoverflow.com/questions/10241212
复制相似问题