首页 > 网站 > WEB开发 > 正文

(一)CodeMirror

2024-04-27 14:16:27
字体:
来源:转载
供稿:网友

(一)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:  <scriptsrc="mode/javascript/javascript.js"></script>  mode: "javascript"

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

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

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

json:                           mode: "application/json"


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表