bidiinput.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!DOCTYPE html>
  2. <html>
  3. <!--
  4. Copyright 2010 The Closure Library Authors. All Rights Reserved.
  5. Use of this source code is governed by the Apache License, Version 2.0.
  6. See the COPYING file for details.
  7. -->
  8. <head>
  9. <title>goog.ui.BidiInput</title>
  10. <script type="text/javascript" src="../base.js"></script>
  11. <script type="text/javascript">
  12. goog.require('goog.ui.BidiInput');
  13. </script>
  14. <link rel="stylesheet" href="css/demo.css">
  15. </head>
  16. <body>
  17. <h1>goog.ui.BidiInput</h1>
  18. <p>
  19. The direction of the input field changes automatically to RTL (right to left)
  20. if the contents is in an RTL language (e.g. Hebrew or Arabic).
  21. </p>
  22. <fieldset>
  23. <legend>A decorated input:&nbsp;</legend>
  24. Text: <input type='text' id='c1' />
  25. <script type='text/javascript'>
  26. var c1 = new goog.ui.BidiInput();
  27. c1.decorate(goog.dom.getElement('c1'));
  28. </script>
  29. </fieldset>
  30. <br />
  31. <fieldset>
  32. <legend>An input created programmatically:&nbsp;</legend>
  33. Text: <span id='c2'></span> !
  34. <script type='text/javascript'>
  35. var c2 = new goog.ui.BidiInput();
  36. c2.render(goog.dom.getElement('c2'));
  37. </script>
  38. </fieldset>
  39. <br />
  40. <fieldset>
  41. <legend>A decorated textarea:&nbsp;</legend>
  42. <textarea id='c3'></textarea>
  43. <script type='text/javascript'>
  44. var c3 = new goog.ui.BidiInput();
  45. c3.decorate(goog.dom.getElement('c3'));
  46. </script>
  47. </fieldset>
  48. <br />
  49. <div dir='rtl'>
  50. <fieldset>
  51. <legend>Right to left div:&nbsp;</legend>
  52. <textarea id='c4'></textarea>
  53. <script type='text/javascript'>
  54. var c4 = new goog.ui.BidiInput();
  55. c4.decorate(goog.dom.getElement('c4'));
  56. </script>
  57. </fieldset>
  58. </div>
  59. </body>
  60. </html>