0

默认文本是输入您的关键字,我点击谷歌语音识别并说 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>
4

1 回答 1

0

这是因为 webkit 语音事件不会触发输入focus事件。你应该听webkitspeechchange事件。像这样:

onwebkitspeechchange = "this.value = this.value.replace('Enter your keywords here','')";
于 2012-05-19T17:39:57.857 回答