1

Can someone please help me sort out a few errors from some javascript functions: I'll point which function, error with the link of the script written in fiddle.These functions are working perfectly but those errors came up in web developers tool.

(1) calling Flexslider js, this is the function:

ERROR : Uncaught ReferenceError: SyntaxHighlighter is not defined

     <script type="text/javascript">
    $(function(){
      SyntaxHighlighter.all();      <----- ERROR
    });
    $(window).load(function(){
      $('.flexslider').flexslider({
        animation: "slide",
        start: function(slider){
          $('body').removeClass('loading');
        }
      });
    });
  </script>

(2) ERROR - This script is to disable the right button. the entire script can be seen here : http://jsfiddle.net/DQ6EX/

 captureEvents() is deprecated. This method doesn't do anything.

(3) ERROR - event.returnValue is deprecated. Please use the standard event.preventDefault() instead. Line 3345

http://code.jquery.com/jquery-1.9.1.js

 // by a handler lower down the tree; reflect the correct value.


this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
            src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;

1 Answer 1

1

To answer #(1)

You have to use the autoloader like it says in the demo page http://alexgorbatchev.com/SyntaxHighlighter/manual/demo/
You don't have to use all the stuff only which code you want to format.
For each of those formats you need a specific javascript file which starts like shXXX.js

function path()
{
    var args = arguments,
        result = []
        ;

    for(var i = 0; i < args.length; i++)
        result.push(args[i].replace('@', '/pub/sh/current/scripts/'));

    return result
};

SyntaxHighlighter.autoloader.apply(null, path(
    'applescript            @shBrushAppleScript.js',
    'actionscript3 as3      @shBrushAS3.js',
    'bash shell             @shBrushBash.js',
    'coldfusion cf          @shBrushColdFusion.js',
    'cpp c                  @shBrushCpp.js',
    'c# c-sharp csharp      @shBrushCSharp.js',
    'css                    @shBrushCss.js',
    'delphi pascal          @shBrushDelphi.js',
    'diff patch pas         @shBrushDiff.js',
    'erl erlang             @shBrushErlang.js',
    'groovy                 @shBrushGroovy.js',
    'java                   @shBrushJava.js',
    'jfx javafx             @shBrushJavaFX.js',
    'js jscript javascript  @shBrushJScript.js',
    'perl pl                @shBrushPerl.js',
    'php                    @shBrushPhp.js',
    'text plain             @shBrushPlain.js',
    'py python              @shBrushPython.js',
    'powershell ps posh     @shBrushPowerShell.js',
    'ruby rails ror rb      @shBrushRuby.js',
    'sass scss              @shBrushSass.js',
    'scala                  @shBrushScala.js',
    'sql                    @shBrushSql.js',
    'vb vbnet               @shBrushVb.js',
    'xml xhtml xslt html    @shBrushXml.js'
));
SyntaxHighlighter.all();

To answer #(2)

The deprecated warning about captureEvents() is just so it works for older Netscape Browsers I wouldn't worry about it, just a warning after all.

This actually works right, just when putting stuff in jsfiddle don't use <script> </script> tags it does those for you automatically.
Plus you should probably be using <script type="text/javascript">...</script>, it even tells you not to use them when you try to use this error in yellow

Input plain JavaScript code, no HTML.

var isNS = (navigator.appName == "Netscape") ? 1 : 0;

if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);

function mischandler(){
return false;
}

function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
Sign up to request clarification or add additional context in comments.

25 Comments

SSpoke ,thank you so much for taking time on this,appreciate it a lot, can I speak to you by chat? please I beg you I need to ask you just something that is so easy that no one wants to help me with, it's been 3 weeks I've been stuck on plus 2 weeks without being allowed to make questions.Please help me, its something so simple, I dont know what to do, I dont know javascript, I put the function altogether of an example I found but there is just one missing piece there are two buttons but one its not working.Please help me
Just paste the whole code in a jsfiddle and paste link here and I'll try to fix it.
spasibo , jsfiddle.net/2Y7sd/2 , Minor Problem that would take just a minute of your time. Fade function with buttons used to fade the current content inside a column into the second content (hidden div).Content1 (id="c1") is there inside the column when the page loads, press 2nd "square" (div class="square") button----> (content1 fades) content2 (id="c2") appears. Then press 1rst "square" button---->nothing happens no way of going back to content1 ( id="c1") <-----------------ISSUE
forgot to put underframeworks and Extensions jquery1.10.1 , onload is fine
< div id="details" >< div style="display" id="c1" > one of these two divs might not be in the right place that could be the reason for this minor issue,or there is something missing within the js function to make the first button go back to first content,honestly dont know, just guessing.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.