Olaf, I take it that "mySettings" is a variable defined in your set.js
script, is that right?

When you load a script dynamically, the JavaScript interpreter does not halt
and wait for that script. Your code continues executing without pause,
therefore any variables defined by that script are not available yet.

You should change set.js to call a function instead of merely setting a
variable. The function it calls will be where you put the code that depends
on mySettings.

-Mike

> From: Olaf Gleba
> 
> Hi.
> 
> I think i have a problem of understanding in what order the 
> nodes get into the DOM.
> 
> I have a select that is bound to different Text-Converter 
> which is present within all content input areas in our little 
> CMS. I integrated the markItUp! Editor successfully at least 
> (thanks Jay for the hints).  
> Fortunately there are Text-Converter Plug-Ins available yet 
> which fits perfectly with the parsing options we afford.
> 
> So i of course must take action on every 'onchange' of the 
> select to load at least the 'set.js' of the appropriate set 
> and insert it into the DOM to make them available. This is 
> what i want to achive described within the example below 
> (excerpt,- the 'onload' handling of page skipped).
> 
> But everytime i select an option firebug gives me a 
> 'mySettings are not defined'. So it seems the dynamically 
> generated script tag are 'too late'.
> 
> Anyone has a hint what i do wrong?
> 
> bye and thanks in advance
> Olaf
> 
> /* Example start here */
> 
> jQuery(document).ready(function(){
> 
> // Foremost Mozilla browser only
> jQuery('#simple_page_text_converter option').click(function() {
>       
>       var t = jQuery(this).text().toLowerCase();
> 
>       var s=document.createElement('script');
>       
> s.setAttribute('src','../static/libs/thirdparty/markitup/sets/
> ' + t + '/set.js');
>       s.setAttribute('type','text/javascript');
>       document.getElementsByTagName('body')[0].appendChild(s);
>       
>       ...
>       
>       jQuery('#simple_page_content').markItUp(mySettings);
> });
> 
> });
> 
> /* Example ends here */
> 
> 
> 
> 
> --
> Olaf Gleba : creatics media.systems
> tel. +49 (0)212 38 32 94 30 : fax. +49 (0)212 38 32 94 31 
> [EMAIL PROTECTED] : http://www.creatics.de http://www.creatics.de/keys/
> 
> 
> 
> 

Reply via email to