Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Javascript / Client Side Development

JS on Demand or Help to Initialize Invisible Object


Hello,
I am installing TinyMCE on my app. TinyMCE is a free HTML editor.
Initializations goes well when I include one JavaScript file and add
initialization code inside of HTML page, something like this:

<script language="javascript" type="text/javascript"
src="tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({....});
function myCustomExecCommandHandler(){...}
function customSave(id, content) {...}
</script>

However, my html textarea element, where tinyMCE object gets reference
to is invisible on thepage until user calls it to be visible with
display:block;. Therefore, I wanted to call the code above when it is
needed to initialize tinyMCE object. So I put javascript code into one
more remote file and call all two files upon request with similar
function:

function tinyMCEOnDemand(){
   var head = document.getElementsByTagName("head")[0];
   var script = document.createElement('script');
   script.id = 'tinyMCEScriptInitializer';
   script.type = 'text/javascript';
   script.src = "tinyInit.js";
   head.appendChild(script);

}

The problem is that tinyMCE is either undefined or does not have
properties (depends on which order of two requested files is used). I
do not know what exactly to ask but perhaps, you can share your idea
of how to initialize the object (tinyMCE) applied to an invisible
element or just any other thoughts?
Thank you
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc