[ 検索 ]

Android 上に検索ボタンを押したときに発生します。

document.addEventListener("searchbutton", yourCallbackFunction, false);

詳細

Android のデフォルト検索ボタンの動作をオーバーライドする必要がある場合 '[ 検索 ]' イベントのイベント リスナーを登録できます。

通常アプリケーションに使用する必要があります document.addEventListener 一度のイベント リスナーをアタッチし、 [deviceready](events.deviceready.html) イベントが発生します。

サポートされているプラットフォーム

  • アンドロイド

簡単な例

document.addEventListener("searchbutton", onSearchKeyDown, false);

function onSearchKeyDown() {
    // Handle the search button
}

完全な例

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Search Button Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    function onLoad() {
        document.addEventListener("deviceready", onDeviceReady, false);
    }

    // device APIs are available
    //
    function onDeviceReady() {
        // Register the event listener
        document.addEventListener("searchbutton", onSearchKeyDown, false);
    }

    // Handle the search button
    //
    function onSearchKeyDown() {
    }

    </script>
  </head>
  <body onload="onLoad()">
  </body>
</html>