将 x-webkit-speech 与文本区域一起使用
我的网络应用程序中有一个字段,用户可以在其中输入大量文本。我想实现 x-webkit-speech 元素。它适用于所有
<input>
盒子,但我无法让它在
<textarea name="uxMyInput" rows="30" cols="20" id="uxMyInput" onblur="convert();" style="width:100%;" x-webkit-speech=""></textarea>
I have a field in my webapp where users are entering a large amount of text. I would like to implement the x-webkit-speech element. it works in all the
<input>
boxes, but I cannot get it to render in the
<textarea name="uxMyInput" rows="30" cols="20" id="uxMyInput" onblur="convert();" style="width:100%;" x-webkit-speech=""></textarea>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目前它仅适用于输入。我认为最终会支持更长的文本输入,但由于用户可能期望记录更长的条目,我怀疑他们担心处理的准确性和时间会受到影响。
Currently it only works on inputs. I assume that support for longer text entry will come eventually, but as users might expect to record much longer entries I suspect they were worried the accuracy and time for processing would be affected.
答案相当简单:在文本区域上方添加一个文本输入框,然后使用 onwebkitspeechchange 属性将新识别的文本从输入框复制到文本区域。
我在jsfiddle上发布了一个代码示例:
http://jsfiddle.net/theo/GZ5mL/
The answer is fairly straightforward: add a text input box above your text area and then use the onwebkitspeechchange attribute to cause the newly recognized text to be copied from the input box to the text area.
I have posted a code sample on jsfiddle:
http://jsfiddle.net/theo/GZ5mL/