乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      HTML5之語音識別實例

       昵稱11261516 2013-01-31
      HTML5之語音識別實例
      代碼
      <input type="text"  x-webkit-speech id="d1" lang="zh-CN" x-webkit-grammar="bUIltin:search" onwebkitspeechchange="foo()"/>

      <script>
      function foo(){
      var n = document.getElementById("d1").value;
      if(n == "百度"){
          window.location.;
      }else{
      window.location.;
      }
      }
      </script>

      說明:
      1)x-webkit-speech:語音識別支持屬性
          <input type="text" x-webkit-speech/>
      2)lang:設(shè)置語言種類,比如漢語:lang="ch-CN"
          <input type="text" x-webkit-speech lang="ch-CN"/>
      3) x-webkit-grammar :語音輸入語法
          比如: x-webkit-grammar="bUIltin:search"使得語音輸入的內(nèi)容盡量靠近搜索內(nèi)容,去除多余的字符,例如“的、啦”等
          <input type="text" x-webkit-speech lang="ch-CN"  x-webkit-grammar="bUIltin:search"/>
      4) onwebkitspeechchange :語音輸入事件,當(dāng)語音改變時觸發(fā)
            比如:onwebkitspeechchange="foo()" ,當(dāng)停止語音時,會觸發(fā)js中的foo()函數(shù)
          <input type="text" x-webkit-speech lang="ch-CN"  x-webkit-grammar="bUIltin:search"                      
            onwebkitspeechchange="foo()"/>
            此時,需要寫相應(yīng)的JavaScript函數(shù)foo()
            <script>
                function foo(){
                      //函數(shù)體,如下:
                      alert(8);
                }
            </script>

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多