9

I am just following the instruction over here and its not working any help?

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

<script type="text/javascript" src="sh/scripts/shBrushJScript.js"></script>

<link href="sh/styles/shCore.css" rel="stylesheet" type="text/css" />
<!--<link href="sh/styles/shCoreDefault.css" rel="stylesheet" type="text/css" />-->
<link href="sh/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />

<pre class="brush: js">
    /**
     * SyntaxHighlighter
     */
    function foo()
    {
        if (counter <= 10)
            return;
        // it works!
    }
</pre>
<script type="text/javascript">
     SyntaxHighlighter.all()
</script>

Found some error in console don't know wt to do with it.

Uncaught ReferenceError: XRegExp is not defined shCore.js:123 Uncaught TypeError: Cannot read property 'Highlighter' of undefined shBrushJScript.js:45 Uncaught TypeError: Cannot read property 'all' of undefined test.php:21 Attr.specified is deprecated. Its value is always true.

Skyyy
  • 1,539
  • 2
  • 23
  • 60

2 Answers2

2

I found this LINK

Try to keep all your local files for syntax highliter in same directory like this:

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

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

OR

<script type="text/javascript" src="sh/scripts/shCore.js"></script>

<script type="text/javascript" src="sh/scripts/shBrushJScript.js"></script>
Imran Bughio
  • 4,811
  • 2
  • 30
  • 53
0

I quickly made a simple html site to check your problem and it works for me:

<html>
<head>
    <link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script>
    <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script>
    <link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <pre class="brush: js">
    /**
    * SyntaxHighlighter
    */
    function foo()
    {
        if (counter <= 10)
            return;
        // it works!
    }
    </pre>
    <script type="text/javascript">
        SyntaxHighlighter.all()
    </script>
</body>
</html>

So I'm pretty sure, you're having some referencing issue as the files in the <script> tag are not correctly referencing the local files. Try again with the remote files offered by the author of the script. Does it work then?

ConcurrentHashMap
  • 4,998
  • 7
  • 44
  • 53