我想要在页面上点击一个文字,然后播放音频,怎么实现?谢谢

解决方案 »

  1.   

    import java.io.IOException;public class Test {

    public static void main(String[] args) throws IOException{
    Runtime.getRuntime().exec("C:/Program Files/TTPlayer/TTPlayer.exe F:/MP3/很爱很爱你.mp3");
    }
    }
      

  2.   

    谢谢  lodachi,我没说清楚,我的网页上有很多汉字,我想点击每一个字播放它的读音,每字只读一遍,想用javascript控制PS:很喜欢lodachi的头像
      

  3.   

    在页面body里加上
    <bgsound id="snd" loop="0" src="">然后再<head></head>之间加上
    <script>
    function playSound(src){
    var _s = document.getElementById('snd');
    if(src!='' && typeof src!=undefined){
    _s.src = src;
    }
    }
    </script>调用时,比如用按钮调用:
    <input type="button" value="声音" onclick="playSound('这里填写你的声音文件路径')">声音文件尽量要小,几十K到wav文件即可 
      

  4.   

    你是想用JavaScript把汉字转化成音频文件,然后再播放出来?
      

  5.   

    谢谢 lodachi,问题完美解决ps:我也是爷们,纯的,我只是说了喜欢你的头像,呵呵!