Home/Download | Install | To-do | About |
Download and uncompress CodePress under a directory inside your webserver.
Example: http://yourserver/codepress/
Since CodePress is pure JavaScript and HTML, you can also test it without a webserver.
Insert CodePress script somewhere in your page inside the <head>
or above the </body>
tag.
<script src="/codepress/codepress.js" type="text/javascript"></script>
Add the <textarea>
tag to the place on your page you want CodePress to appear. CodePress will inherit the width and height of your textarea.
When the page loads, it will automatically replace your textarea with a CodePress window.
<textarea id="myCpWindow" class="codepress javascript linenumbers-off">
// your code here
</textarea>
javascript
portion of the class="" means that the language being edited is JavaScript.
codepress
portion of the class="" is mandatory and indicates a textarea to be replaced for a CodePress window.
linenumbers-off
, autocomplete-off
and readonly-on
.
<textarea id="xx"...>
) and do not use characters like "." (dot) for id names.
textarea_id.edit('other_textarea_id','language')
textarea_id.edit('h1 { color: red; }','css')
textarea_id.edit(document.getElementById('myCode').innerHTML,'html')
textarea_id.getCode()
textarea_id.toggleEditor()
textarea_id.toggleLineNumbers()
textarea_id.toggleReadOnly()
textarea_id.toggleAutoComplete()