效果图:
上代码:
<!DOCTYPE html>
<html><head><meta charset="UTF-8"><title>语音朗读测试</title><script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script><script type="text/javascript">function startRead() {$("#readbut").attr("disabled","disabled");var readText=$("#readText").val();var msg = new SpeechSynthesisUtterance(readText);window.speechSynthesis.speak(msg);$("#readbut").removeAttr("disabled");}</script></head><body><textarea id="readText" rows="20" cols="100"></textarea><br /><input type="button" id="readbut" onclick="startRead();" value="开始阅读" /></body></html>