123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <title>Editor</title>
- <style type="text/css" media="screen">
- .ace_editor {
- border: 1px solid lightgray;
- margin: auto;
- height: 200px;
- width: 80%;
- }
- .scrollmargin {
- height: 80px;
- text-align: center;
- }
- </style>
- </head>
- <body>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <h1>Filler</h1>
- <textarea id="editor">function foo(items) {
- var x = "All this is syntax highlighted";
- return x;
- }</textarea>
- <button id="action">Click Me!</button>
- <!-- load ace -->
- <script src="../src/ace.js"></script>
- <script>
- var editor = ace.edit("editor");
- editor.setTheme("ace/theme/monokai");
- editor.session().setMode("ace/mode/javascript");
- window.editor = editor;
- document.getElementById("action").addEventListener('click',function () {
- editor.navigateTo(0,0);
- editor.getSelection().selectTo(0,5);
- editor.focus();
- return false;
- });
- </script>
-
- </body>
- </html>
|