menuitem-key.xul 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?xml version="1.0"?>
  2. <window class="reftest-wait" onload="changeKeys()"
  3. xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  4. <menuitem id="m1" label="Menu1" key="keyone"/>
  5. <menuitem id="m2" label="Menu2" key="keytwo"/>
  6. <menuitem id="m3" label="Menu3"/>
  7. <menuitem id="m4" label="Menu4"/>
  8. <menuitem id="m5" label="Menu5"/>
  9. <menuitem id="m6" label="Menu6" key="keythree" acceltext="Text"/>
  10. <menuitem id="m7" label="Menu7" key="keythree" acceltext="Text"/>
  11. <menuitem id="m8" label="Menu8" key="keythree" acceltext="Text"/>
  12. <menuitem id="m9" label="Menu9" key="keytwo"/>
  13. <script>
  14. function changeKeys()
  15. {
  16. document.getElementById("m1").setAttribute("key", "keytwo");
  17. document.getElementById("m2").removeAttribute("key");
  18. document.getElementById("m3").setAttribute("key", "keythree");
  19. document.getElementById("m4").setAttribute("key", "keyone");
  20. document.getElementById("m4").setAttribute("acceltext", "Text");
  21. document.getElementById("m5").setAttribute("acceltext", "Text");
  22. document.getElementById("m5").setAttribute("key", "keytwo");
  23. document.getElementById("m6").removeAttribute("key");
  24. document.getElementById("m7").removeAttribute("acceltext");
  25. document.getElementById("m8").removeAttribute("key");
  26. document.getElementById("m8").removeAttribute("acceltext");
  27. document.getElementById("m9").removeAttribute("key");
  28. document.documentElement.className='';
  29. }
  30. </script>
  31. <keyset>
  32. <key id="keyone" key="Z" modifiers="control"/>
  33. <key id="keytwo" key="Y" modifiers="control"/>
  34. <key id="keythree" key="X" modifiers="accel"/>
  35. </keyset>
  36. </window>