title: How do I implement text-to-speech in html or javascript for web browsers?
body: <p>I want a webpage to read some text out loud (in a robot voice!).</p>
  
  <p>On this webpage, there's a button that, when clicked, randomly displays one of 3 sentences.  I'd like to have another button that can be clicked that will read the text aloud.  Alternatively, the text can be read aloud automatically when the first button is clicked.</p>
  
  <p>here's the relevant code...</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;
    &lt;script type="text/javascript"&gt;
      var randomStrings = [
       "this is an example of a random string",
       "here's another random string",
       "or maybe this string will be chosen at random"
        ];
      function RndMsg() {
        var msg = randomStrings[Math.floor(Math.random()*randomStrings.length)];
        document.getElementById('randomDiv').innerHTML = msg;
        }
    &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;form action="" method="post" onsubmit="return false"&gt;
      &lt;input type="button" value="Randomize!" name="sessionid" onclick="RndMsg()"/&gt;
  //click the button-&gt;text appears below... i want browser or OS to read it aloud
    &lt;/form&gt;
    &lt;form action="" method="post" onsubmit="return false"&gt;
      &lt;div id="randomDiv"&gt; &lt;/div&gt;
    &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am a newbie, so I'm wondering if there's a simple way to do this.  thanks!  </p>