簡體   English   中英

speack函數,即無法正常工作的js

[英]the speack function i.e articulate js which is not working

我正在使用articulate.js向網站語音添加文本。 代碼如下:

<body>
<div class="articulate-area">
  <button onclick="speak('article')">Speak All</button>
  <button onclick="speak('div.intro')">Speak Intro</button>
  <button onclick="speak('div.speech')">Speak Speech</button>
  <button onclick="pause()">Pause</button>
  <button onclick="resume()">Resume</button>
</div>

<article>
  <div class="intro">
    <h1>The Gettysburg Address</h1>
    <h2>Delivered by Abraham Lincoln on November 19, 1863</h2>
    <h3>Beginning with the iconic phrase <q>Four score and seven years ago,</q> this speech is generally regarded as the most famous in American history.</h3>
  </div>

  <div class="speech">
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/915932/lincoln.jpg" alt="A Portrait of the Sixteenth President">

    <p>Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.</p>    
    <p>Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.</p>

  </div>
</article>
<body>
<script>
function speak(obj) {
  $(obj).articulate('speak');
};

function pause() {
  $().articulate('pause');
};

function resume() {
  $().articulate('resume');
};
</script>

上面是將tts添加到無法正常運行的網頁的代碼,我是否需要向該網頁添加任何其他腳本? articulate.js官方網站告訴您,它與chrome兼容。 但我沒有得到語音輸出。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM