版权声明:本文为博主原创文章,如需转载请联系QQ:1943073444,未经博主允许不得转载。 https://blog.csdn.net/japanstudylang/article/details/88312532
<input id="id1" type="text" />
<button>听语音</button>
<script>
function sayIt(query, language) {
var q = new SpeechSynthesisUtterance(query);
q.lang = language;
// q.rate = 1.2;
q.rate = 1.0;
speechSynthesis.speak(q);
}
sayIt('我在南京湖南路,欢迎来学测试和开发,我是杨文', 'zh-CN');
</script>