|
步骤:
1、安装Speech SDK 2、安装后设置
代码
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> //创建 Sapi SpVoice 对象 var VoiceObj = new ActiveXObject("Sapi.SpVoice"); //将文本读出来 function ReadVoice() { var voice = document.getElementById("txtVoice").value; VoiceObj.Speak(voice, 1); return false; } </script> </head> <body> <form id="form1" runat="server"> <div> <%--将要被读的文本--%> <input id="txtVoice" type="text" /> <br /> <%--读 按钮--%> <input id="btnRead" type="button" value="读" onclick="return ReadVoice()" /> </div> </form> </body> </html>
运行,在文本框中输入中文,点“读”就将文本就读出来了。
注: |


浙公网安备 33010602011771号