我需要php页面中每个具有不同维度的代码镜像编辑器。
像下面一样,我们可以创建一个代码镜像编辑器的实例,但它应该具有相同的维度。有什么方法可以创建不同的维度吗?
function editor(id)
{
CodeMirror.fromTextArea(id, {
height: "350px",
parserfile: "parsexml.js",
stylesheet: "css/xmlcolors.css",
path: "js/",
continuousScanning: 500,
lineNumbers: true
});
}
editor('code1');
editor('code2');
是的,在编辑器函数的其他参数中添加维度。
例如:
function editor(id, h)
{
CodeMirror.fromTextArea(id, {
height: h,
parserfile: "parsexml.js",
stylesheet: "css/xmlcolors.css",
path: "js/",
continuousScanning: 500,
lineNumbers: true
});
}
editor('code1', '350px');
editor('code2', '450px');