利用javascript+微软TTS实现web中文发音

要实现中文朗读,需要安装win98或以上版本,Microsoft Internet Explorer 5.0
或以上版本,因为要实现中文发音必须同时安装Speech SDK 5.1 Language Pack file。

可以在官网下载:http://www.microsoft.com/downloads


最简单例子:

 

<script language="JavaScript">
  var VoiceObj = new ActiveXObject("Sapi.SpVoice");
  function SpeakText() {
    var my_test='你是谁';
    VoiceObj.Speak( my_test, 1 );
  }    
SpeakText();
</SCRIPT>

 

说明:官网只提供简体的语言包,所以如果是繁体中文字要发音,请先用js转换编码

参考文章见附件!

Book Description Like it or not, JavaScript is everywhere these days—from browser to server to mobile—and now you, too, need to learn the language or dive deeper than you have. This concise book guides you into and through JavaScript, written by a veteran programmer who once found himself in the same position. Speaking JavaScript helps you approach the language with four standalone sections. First, a quick-start guide teaches you just enough of the language to help you be productive right away. More experienced JavaScript programmers will find a complete and easy-to-read reference that covers each language feature in depth. Complete contents include: JavaScript quick start: Familiar with object-oriented programming? This part helps you learn JavaScript quickly and properly. JavaScript in depth: Learn details of ECMAScript 5, from syntax, variables, functions, and object-oriented programming to regular expressions and JSON with lots of examples. Pick a topic and jump in. Background: Understand JavaScript’s history and its relationship with other programming languages. Tips, tools, and libraries: Survey existing style guides, best practices, advanced techniques, module systems, package managers, build tools, and learning resources. Table of Contents Part I: JavaScript Quick Start Chapter 1. Basic JavaScript Part II: Background Chapter 2. Why JavaScript? Chapter 3. The Nature of JavaScript Chapter 4. How JavaScript Was Created Chapter 5. Standardization: ECMAScript Chapter 6. Historical JavaScript Milestones Part III: JavaScript in Depth Chapter 7. JavaScript’s Syntax Chapter 8. Values Chapter 9. Operators Chapter 10. Booleans Chapter 11. Numbers Chapter 12. Strings Chapter 13. Statements Chapter 14. Exception Handling Chapter 15. Functions Chapter 16. Variables: Scopes, Environments, and Closures Chapter 17. Objects and Inheritance Chapter 18. Arrays Chapter 19. Regular Expressions Chapter 20. Dates Chapter 21. Math Chapter 22. JSON Chapter 23. Standard Global Var
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值