谷歌语音识别搜索文本问题

Google voice recognition to search text issue

本文关键字:问题 文本 搜索 语音识别 谷歌      更新时间:2023-09-26

默认文本是输入您的关键字,我单击谷歌语音regonition并说Facebook API.然后Facebook API与默认文本一起打印,如下所示.输入您的文本Facebook API ...谷歌浏览器只有效

 <form method="GET" name="search" action="index2.php"> 
   <table cellpadding="0px" cellspacing="0px"><tr><td>
   <input type="text" name="q" value="Enter your keywords here" 
 onfocus="if (this.value == 'Enter your keywords here') {this.value = '';}" onblur="if      (this.value == '') {this.value = 'Enter your keywords here';}"
x-webkit-speech style="left:9px;top:4px;position:relative;background-   color:#fafafa;border:1px solid;color:#333;font-size:1.4em;width:400px;height:28px"; />
</td><td><input type="submit" value="Search" name="search" id="searchbutton">
</td></tr></table></form>

这是因为 webkit 语音事件不会触发输入的focus事件。你应该听webkitspeechchange事件。喜欢这个:

onwebkitspeechchange = "this.value = this.value.replace('Enter your keywords here','')";