Home | History | Annotate | Download | only in data
      1 <html>
      2   <head>
      3     <title>context menu</title>
      4     <meta http-equiv="x-ua-compatible" content="chrome=1" />
      5     <script type="text/javascript" src="chrome_frame_tester_helpers.js">
      6     </script>
      7     <script>
      8     // Default text value used to test cut/copy/paste etc.
      9     var INIT_VAL = "SomeInitializedTextValue";
     10 
     11     // Verify the expected result based on action and post message to host.
     12     function verifyTextFieldContents(event) {
     13       var textField = document.getElementById("textField");
     14       var selectedValue = textField.value.substring(textField.selectionStart,
     15           textField.selectionEnd);
     16 
     17       if (selectedValue == INIT_VAL) {
     18         window.externalHost.postMessage("OK");
     19       } else {
     20         window.externalHost.postMessage("Fail");
     21       }
     22     }
     23 
     24     // Do some initialization work like setting text field value, 
     25     // and selecting the value by default before the test starts.
     26     function init() {
     27       var action = getURLParameter("action");
     28 
     29       document.getElementById("textField").value = INIT_VAL;
     30       document.getElementById("textField").focus();
     31       if (action != "selectall") {
     32         document.getElementById("textField").select();
     33       }
     34 
     35       window.externalHost.onmessage = verifyTextFieldContents;
     36     }
     37     </script> 
     38   </head>
     39 
     40   <body leftmargin="0" topmargin="0" onload="init()">
     41     <input type="text" name="textField" id="textField" size="25" value=""></td>
     42   </body>
     43 </html>
     44