CodePress is web-based source code editor with syntax highlighting written in JavaScript that colors text in real time while it's being typed in the browser.

Go to for updates.


choose example in:


  1. 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.

  2. Insert CodePress script somewhere in your page inside the <head> or above the </body> tag.

    <script src="/codepress/codepress.js" type="text/javascript"></script>

  3. 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

    • The javascript portion of the class="" means that the language being edited is JavaScript.
    • The codepress portion of the class="" is mandatory and indicates a textarea to be replaced for a CodePress window.
    • Other class options are linenumbers-off, autocomplete-off and readonly-on.
    • Careful not to use the same id for two different CodePress windows (<textarea id="xx"...>)

You also can...

  1. Open/edit code from a different textarea.
    Example: textarea_id.edit('other_textarea_id','language')
  2. Get code from CodePress window.
    Example: textarea_id.getCode()
  3. Turn on/off CodePress editor and return to the regular textarea.
    Example: textarea_id.toggleEditor()
  4. Turn on/off line numbers.
    Example: textarea_id.toggleLineNumbers()
  5. Turn on/off read only.
    Example: textarea_id.toggleReadOnly()
  6. Turn on/off auto-complete.
    Example: textarea_id.toggleAutoComplete()


CodePress is distributed under the LGPL. If your software is compatible with this licence or it is under Creative Commons, you can use it as you want. Just keep the credits somewhere around.