Topic: tiny_mce.js on demand
Hi, i want to load tiny_mce.js only when i need edit some message (edit button onclick)... but all fail...
I try this (very simplified....):
function includeJS(source) {
var e = document.createElement('script');
e.setAttribute('type', 'text/javascript');
e.text = source;
document.getElementsByTagName('HEAD')[0].appendChild(e);
}
function require(url) {
var cnx = (window.ActiveXObject) ? new ActiveXObject("MsXml2.XmlHttp") : new XMLHttpRequest();
if( cnx ) {
cnx.open("GET", url, false);
cnx.send(null);
includeJS(cnx.responseText);
}
} else {
alert("ERROR");
}
}
function edit() {
--- blablabla ---
require('/tinymce/tiny_mce.js');
tinyMCE.init({.........});
--- blablabla ---
}
<input type="button" value="Edit" onclick="edit()" />But don't work.... i modify tiny_mce.js to 'hack' t.baseURL on _init method and load scripts to my own functions (document.write is a problem - blank document)... plugins are included but nothing happend... no errors.
Then, i change my load script to this (very simplified too):
function require(url) {
var e = document.createElement('script');
e.setAttribute('type', 'text/javascript');
e.src = url;
document.getElementsByTagName('HEAD')[0].appendChild(e);
--- WAIT for load script ----
}and same problem ![]()
some idea?
Thanks in advance ![]()
--- Sorry, i am spanish... my english is too bad ![]()
Last edited by Tito (2008-10-07 12:44:57)