Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript CodeMirror不';显示HTML模式_Javascript_Jquery_Html_Css_Codemirror - Fatal编程技术网

Javascript CodeMirror不';显示HTML模式

Javascript CodeMirror不';显示HTML模式,javascript,jquery,html,css,codemirror,Javascript,Jquery,Html,Css,Codemirror,我试图在我的web应用程序中使用CodeMirror模式,但它不会突出显示“htmlmixed”模式的单词。我不明白出了什么问题。每个文件的路径都是正确的,因为我没有收到任何404错误。以下是我所做的: <!DOCTYPE html> <head> <script src="/node_modules/codemirror/lib/codemirror.js"></script> <link rel="s

我试图在我的web应用程序中使用CodeMirror模式,但它不会突出显示“htmlmixed”模式的单词。我不明白出了什么问题。每个文件的路径都是正确的,因为我没有收到任何404错误。以下是我所做的:

<!DOCTYPE html>
<head>
    <script src="/node_modules/codemirror/lib/codemirror.js"></script>           
    <link rel="stylesheet" href="/path-to/codemirror/lib/codemirror.css">
   <script src="/path-to/codemirror/lib/codemirror.js"></script>
   <script src="/path-to/codemirror/mode/htmlmixed/htmlmixed.js"></script>
   <script src="/path-to/jquery.min.js"></script>
</head>
<html>
    <textarea id="editor"></textarea>
    ....
</html>
<script>
    var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
         lineNumbers: true,
         mode:  "htmlmixed",
         htmlMode: true,
});
</script>

....
var editor=CodeMirror.fromTextArea(document.getElementById(“编辑器”){
行号:对,
模式:“htmlmixed”,
htmlMode:是的,
});
任何帮助都将不胜感激


谢谢大家!

HTML混合模式取决于
xml
javascript
css
模式。必须包含它们才能使
htmlmixed
正常工作

以下是一个例子:

var editor=CodeMirror.fromTextArea(document.getElementById(“编辑器”){
行号:对,
模式:“htmlmixed”,
htmlMode:是的,
});

p我是HTML/p
剧本
log(“我是JS”);
/剧本

这是一条实际路径吗?嗨,ksav,为了简单起见,我刚刚修改了路径。我实际代码中的路径是正确的。