2
"-//W3C//DTD XHTML 1.0 Transitional//EN"
3
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
<title>A Code Editor</title>
7
<script src="jquery-1.2.1.js"></script>
9
<script src="testcode.js"></script>
10
<script src="ace2.js"></script>
12
$(document).ready(function() {
13
var editor = new Ace2Editor();
14
editor.init("editorcontainer", getTestCode(), editorReady);
16
editor.setOnKeyPress(function (evt) {
17
if (evt.ctrlKey && evt.which == "s".charCodeAt(0)) {
18
alert("You tried to save.");
24
function editorReady() {
26
$(window).bind("resize", resizeEditor);
27
setTimeout(function() {editor.focus();}, 0);
30
function resizeEditor() {
31
$("#editorcontainer").get(0).style.height = "100%";
32
editor.getFrame().style.height = ((document.documentElement.clientHeight)-1)+"px";
38
html { overflow: hidden } /* for Win IE 6 */
39
body { margin:0; padding:0; border:0; overflow: hidden; }
40
#editorcontainer { height: 1000px; /* changed programmatically */ }
41
#editorcontainer iframe { width: 100%; height: 100%; border:0; padding:0; margin:0; }
45
<div id="editorcontainer"><!-- --></div>