UPDATE 2018
Modern browser has built in TTS
if ('speechSynthesis' in window) {
var msg = new SpeechSynthesisUtterance('Hello World');
window.speechSynthesis.speak(msg);
}
speechSynthesis
Deprecated
If you don't want to write a lot of code (or import some library that you don't understand), I suggest you use Google TTS services. It's quite simple. For example you have a text like: welcome to Stack overflow
you can call like this:
http://translate.google.com/translate_tts?ie=UTF-8&q=Welcome%20to%20stack%20overflow&tl=en&total=1&idx=0&textlen=23&prev=input
This will return an audio file reading that text. Then your job is to use browser audio to play it. Nice and easy.
PS: Google TTS has really true voice.
Example: http://jsfiddle.net/qspcL/
Reference from: http://jnjnjn.com/187/playing-audio-on-the-ipad-with-html5-and-javascript/