0

デフォルトのテキストはあなたのキーワードを入力することです、そこで私はグーグルの声のレゴニションをクリックしてフェイスブックのAPIを言いました。それからフェイスブックの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音声イベントが入力のイベントをトリガーしないためですfocuswebkitspeechchangeあなたはイベントを聞くべきです。このような:

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