(一)CodeMirror - 基本应用

基本引用:

<link rel="stylesheet" href="../lib/codemirror.css">

<script src="../lib/codemirror.js"></script>

基本应用:

1 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {

2     lineNumbers: true,

3     mode: "javascript"

4 });

对应mode需引用:

javascript:    <script src="mode/javascript/javascript.js"></script>  mode: "javascript"

css:      <script src="mode/css/css.js"></script>         mode: "text/css"

html:      <script src="mode/xml/xml.js"></script>        mode: "text/html"

java:      <script src="mode/clike/clike.js"></script>                     mode: "text/x-java"

json:                                            mode: "application/json"

 

 

你可能感兴趣的:(code)