Html程序  |  32行  |  970 B

<html>
  <head>
    <meta http-equiv="x-ua-compatible" content="chrome=1" />
    <title>ChromeFrame keyevent test</title>
    <script type="text/javascript"
        src="chrome_frame_tester_helpers.js"></script>

    <script type="text/javascript">
      var input_string = "";

      function OnKeyPress() {
        appendStatus("Key pressed: " +
                     String.fromCharCode(event.keyCode).toString());
        input_string += String.fromCharCode(event.keyCode).toString();

        if (input_string.length >= 6) {
          appendStatus("Sending message: " + input_string);
          window.externalHost.postMessage(input_string);
        }
      }
    </script>
  </head>

  <body onkeypress="OnKeyPress()">
    ChromeFrame full tab mode keyboard test. Verifies that keypress events make
    it correctly into ChromeFrame.
    <div id="statusPanel" style="border: 1px solid red; width: 100%">
      Keyboard test running....
    </div>
  </body>
</html>