1.网页版:
1 <script type="text/javascript"> 2 var msg = new SpeechSynthesisUtterance("你是谁"); 3 window.speechSynthesis.speak(msg); 4 </script>
2.webAPP:
1 <div id="Box"></div>
1 var src ="号请用餐"; 2 $("#Box").html('<audio id="tts_autio_id" autoplay="autoplay"><source id="tts_source_id" src="http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=5&per=1&text='+src+'" type="audio/mpeg"><embed id="tts_embed_id" height="0" width="0" src=""></audio>');