注意歌的路径。。贴一段背景音乐的代码你看<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<script LANGUAGE="JavaScript">
<!-- Begin 
var browsername = navigator.appName;
var gettype = browsername;
if (gettype=="Netscape") {
document.write('<embed src="红叶斜落我心寂寞时-钟镇涛.wma" autostart=true WIDTH=196 HEIGHT=49 REPEAT=TRUE>');} else {
alert("dd");
document.write('<BGSOUND SRC="红叶斜落我心寂寞时-钟镇涛.wma" autostart=true loop=false>') 
}
//-->
</script>
</body>
</html>

解决方案 »

  1.   

    路径也正确阿
    我想对路径的
    我的代码如下<bgsound src='' loop='1' id="snd">
    <script> 
    function playSound(){ 
    var _s = document.getElementById('snd'); 
    _s.src = "msg.wav"; 
    }
    function run(){
    playSound();
    setTimeout("run()",3000);
    }
    playSound();
    </script> 
    <input type="button" value="声音" onclick="run()"> 
      

  2.   

    你可以直接在浏览器里面输入地址 http://localhost/msg.wav 访问这个音乐文件?无论提示下载或播放,如果能访问,应该没什么问题吧
      

  3.   

    浏览器里面输入地址 http://localhost/msg.wav 访问这个音乐文件是可以下载的路径绝对没错
      

  4.   

    因为我双击执行html的话就可以换成请求服务器方式就不行
      

  5.   

    那你把_s.src = "msg.wav"; 改成
    _s.src = "http://localhost/msg.wav"; 
    都不行?
      

  6.   

    try..................<html>
    <head></head>
    <body>
    <script>
    function playSound(){
    alert("dd");
    var _s = document.getElementById('snd');_s.src = "msg.wav";}
    function run(){
    playSound();
    setTimeout("run()",3000);
    }
    </script>
    <bgsound src='' loop='1' id="snd">
    <script>
    playSound(); 
    </script></body>
    </html>
      

  7.   

    这个问题用flash解决. 兼容性比较好..
      

  8.   

    用flash干什么
    为什么要用flash
    我在说一次脚本运行绝对正常,只是没有出声音而已,而且脚本绝对运行了alert我早就试验过了难道php这样的话就这么难吗?
      

  9.   


    以html方式运行url是什么?
    是直接在本地放置一个html文件,然后双击该文件;
    还是在地址栏内输入http://....xx/xx.html ?楼主可以分别贴下你两种方式的url吗?
      

  10.   


    以html方式运行url是什么?
    是直接在本地放置一个html文件,然后双击该文件;
    还是在地址栏内输入http://....xx/xx.html ?楼主可以分别贴下你两种方式的url吗?
      

  11.   

    <meta content="text/html;charset=UTF-8" >
    <bgsound src='' loop='1' id="snd">
    <script>
    function playSound(){
    var _s = document.getElementById('snd');
    _s.src = "abc.wma";
    }
    function run(){
    playSound();
    //setTimeout("run()",3000);
    }</script>
    <input type="button" value="声音" onclick="run()">可以听见啊,,是你的音乐有问题不成。........