Hi, i have a little problem with Codemirror (http://codemirror.net/manual.html)
My code
$(document).ready(function ust()
{
pa_textareas();
});
function pa_textareas()
{
var textarea = document.getElementById('ta_1');
var editor_1 = new MirrorFrame(CodeMirror.replace(textarea), {
height: "100%",
width: "100%",
parserfile: ["tokenizejavascript.js", "parsejavascript.js"],
stylesheet: "js/js_parser/jscolors.css",
path: "js/js_parser/",
autoMatchParens: false,
content: 'test kjskljsklj skjs lkj slkj sl',
initCallback: function(getContents) { e1_ct = ''+editor_1.mirror.getCode()+''; },
onChange: function (n) { e1_ct = ''+editor_1.mirror.getCode()+''; }
});
var textarea = document.getElementById('ta_2');
var editor_2 = new MirrorFrame(CodeMirror.replace(textarea), {
height: "100%",
width: "100%",
parserfile: ["tokenizejavascript.js", "parsecss.js"],
stylesheet: "js/js_parser/csscolors.css",
path: "js/js_parser/",
autoMatchParens: false,
content: 'blub kasjdkljas dkjas lkdj alskj dlk',
initCallback: function(getContents) { e2_ct = ''+editor_2.mirror.getCode()+''; },
onChange: function (n) { e2_ct = ''+editor_2.mirror.getCode()+''; }
});
}
I want to insert a button wich format the code but i get always an error.
Button: onclick="editor_2.mirror.reindent();"
Result: -> "editor_2 is not defined"
Thx Peter :)
edit: code fixed