General developer forum

 
 
Picture of Carl LeBlond
Re: Adding javascript to page
 

OK I've been playing with this for a few evenings and not having much luck.

I placed the code in my question/type/marvin/module.js file outside.  The module.js is modified version of jme question type.  It fires up the applet but wipes the page of everything else and I never called the module/functions from render.php.  i think I have code in wrong place.  Here is code i started with.

YUI({
    modules: {
        'external-marvin': {

           //    fullpath: 'http://localhost/marvin/marvin.js';
            fullpath: M.cfg.wwwroot + '../marvin/marvin.js'
        }
    }
}).use('external-marvin', function(Y) {
//    fullpath: 'http://localhost/marvin/marvin.js';
//    alert(M.cfg.wwwroot);
    msketch_name = "MSketch";
    msketch_begin("../../marvin", 520, 460);
    msketch_end();
});

I'm working through the tutorial but I get the feeling its only applies to 2.5?

I tried adding the code to a file in yui directory structure as per tutorial but no go.  Where should this code reside?  Presumably I'd call it from renderer.php much like I do  my current javascript.

 

 
Average of ratings: -