Javascript 谷歌语音识别搜索文本问题
默认文本是输入你的关键字,在这里我单击google voice regonition并说是facebook api。然后facebook api与默认文本一起打印,如下所示。输入你的文本facebook api。。。谷歌浏览器只起作用Javascript 谷歌语音识别搜索文本问题,javascript,html,css,Javascript,Html,Css,默认文本是输入你的关键字,在这里我单击google voice regonition并说是facebook api。然后facebook api与默认文本一起打印,如下所示。输入你的文本facebook api。。。谷歌浏览器只起作用 <form method="GET" name="search" action="index2.php"> <table cellpadding="0px" cellspacing="0px"><tr><td&g
<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语音事件不会触发输入的
焦点事件。您应该收听webkitspeechchange
事件。像这样:
onwebkitspeechchange = "this.value = this.value.replace('Enter your keywords here','')";