最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - SyntaxHighlighter is not defined - Stack Overflow

programmeradmin2浏览0评论

I am trying to integrate this SyntaxHighlighter to my website. I included all files exactly how in the example, but it does not work.

When I take a look at the web concole it says

ReferenceError: SyntaxHighlighter is not defined @ shBrushPhp.js:81

shBrushPhp.js is part of the files i had to include and I wounder why it does not work. Any ideas?

It would also help if you could say me where SyntaxHighlighter is normally defined.

The line where the error occurrs:

Brush.prototype = new SyntaxHighlighter.Highlighter();

I am trying to integrate this SyntaxHighlighter to my website. I included all files exactly how in the example, but it does not work.

When I take a look at the web concole it says

ReferenceError: SyntaxHighlighter is not defined @ shBrushPhp.js:81

shBrushPhp.js is part of the files i had to include and I wounder why it does not work. Any ideas?

It would also help if you could say me where SyntaxHighlighter is normally defined.

The line where the error occurrs:

Brush.prototype = new SyntaxHighlighter.Highlighter();
Share Improve this question edited May 5, 2013 at 16:46 asked May 5, 2013 at 16:40 user2235728user2235728 5
  • 2 Post the code here too – Ejaz Commented May 5, 2013 at 16:42
  • R u include syntaxhighter js above the shBrushPHP.js – Tamil Selvan C Commented May 5, 2013 at 16:46
  • Yes I do, all files are correctly included. – user2235728 Commented May 5, 2013 at 16:46
  • Can you provide a link to the page that this is happening on? Clearly things are not 'correctly' included, since it's not working; being able to see the page in question will let us help you figure out the problem here. – Dancrumb Commented May 5, 2013 at 16:49
  • 1 @Dancrumb He should include code here to make this question a useful one meta.stackexchange./questions/125997/… – Ejaz Commented May 5, 2013 at 16:50
Add a ment  | 

1 Answer 1

Reset to default 4

It's a pity, that the interrogator didnt follow the answers to his questions. So the question is still open and we have wether a link nor a code snippet.

At least i had the same error ("SyntaxHighlighter is not defined") and i solved it with bringing my script-tags into the correct order. So make sure you import both javascript files (shCore.js and shBrushJScript.js) in the right order:

<script type="text/javascript" src="js/shCore.js"></script>
<script type="text/javascript" src="css/shBrushJScript.js"></script>

You can see that in the SyntaxHighlighter website you have linked to.

The SyntaxHighlighter object is initialized when running through the shBrushJScript.js. So at this point the SyntaxHightlighter - defined in shCore.js - have to be known. If the SyntagHighlighter is announced later in the code, shBrushJScript does not know it.

发布评论

评论列表(0)

  1. 暂无评论