相关疑难解决方法(0)

speechSynthesis.speak在chrome中不起作用

我在Windows 10上使用Chrome版本55.0.2883.87 m(64位).

以下简单的html文件重现了该问题,并从我更复杂的应用程序中提取.它应该在页面加载时说出3个单词.它适用于MS Edge和Firefox,但不适用于chrome.几个星期前,这段代码在我的Chrome上工作没问题.

<html>
<head>
    <script lang="javascript">
        window.speechSynthesis.speak(new SpeechSynthesisUtterance("cat"));
        window.speechSynthesis.speak(new SpeechSynthesisUtterance("dog"));
        window.speechSynthesis.speak(new SpeechSynthesisUtterance("bark"));
    </script>
</head>
<body></body>
</html>
Run Code Online (Sandbox Code Playgroud)

google-chrome webspeech-api

8
推荐指数
3
解决办法
1423
查看次数

不同元素的 JavaScript 文本到语音

我正在尝试使用文本转语音来帮助盲人用户使用我的网站作为我项目的一部分,它在输入、选择和按钮元素方面对我来说效果很好。但我也想为标签元素等其他元素发声。我尝试使用 (for) 而不是 id 并尝试使用事件 (mouseover) 而不是 (Click) 但它没有用。你能帮我解决这个问题,或者有什么建议吗?这是我的代码:

<div class="all">

<form action="/action_page.php">
  <div class="container">
    <h1>Register</h1>
    Select Voice: <select id='voiceList'></select> <br><br>

    <p>Please fill in this form to create an account.</p>
    <hr>
    <input id='text1' type="text" placeholder="Enter Email" name="email" required>
    <label id="email" for="email"><b>Email</b></label>

<br/>
 <label for="email"><b>Name </b></label>
    <input id='text2' type="text" placeholder="Enter Name" name="email" required>
<br/>
    <label for="psw"><b>Password </b></label>
    <input id='text3' type="password" placeholder="Enter Password" name="psw" required>
<br/>
    <label for="psw-repeat"><b>Mobile </b></label>
    <input id='text4' type="password" placeholder="Mobile" name="psw-repeat" required>
    <br/>
        <label for="psw"><b>Gender </b></label>
   <select   id = …
Run Code Online (Sandbox Code Playgroud)

html javascript

7
推荐指数
1
解决办法
337
查看次数

标签 统计

google-chrome ×1

html ×1

javascript ×1

webspeech-api ×1