| <html> |
| <head> |
| <title>context menu</title> |
| <meta http-equiv="x-ua-compatible" content="chrome=1" /> |
| <script type="text/javascript" src="chrome_frame_tester_helpers.js"> |
| </script> |
| <script> |
| // Default text value used to test cut/copy/paste etc. |
| var INIT_VAL = "SomeInitializedTextValue"; |
| |
| // Verify the expected result based on action and post message to host. |
| function verifyTextFieldContents(event) { |
| var textField = document.getElementById("textField"); |
| var selectedValue = textField.value.substring(textField.selectionStart, |
| textField.selectionEnd); |
| |
| if (selectedValue == INIT_VAL) { |
| window.externalHost.postMessage("OK"); |
| } else { |
| window.externalHost.postMessage("Fail"); |
| } |
| } |
| |
| // Do some initialization work like setting text field value, |
| // and selecting the value by default before the test starts. |
| function init() { |
| var action = getURLParameter("action"); |
| |
| document.getElementById("textField").value = INIT_VAL; |
| document.getElementById("textField").focus(); |
| if (action != "selectall") { |
| document.getElementById("textField").select(); |
| } |
| |
| window.externalHost.onmessage = verifyTextFieldContents; |
| } |
| </script> |
| </head> |
| |
| <body leftmargin="0" topmargin="0" onload="init()"> |
| <input type="text" name="textField" id="textField" size="25" value=""></td> |
| </body> |
| </html> |