如何调用初始化函数

时间:2015-07-08 14:27:06

标签: javascript jquery

$main(function(){
    org.mathdox.formulaeditor.FormulaEditor = $extend(Object, {

       textarea : null,
       canvas : null,
       presentation : null,
       cursor : null,

       initialize : function(textarea, canvas) {...},

       other functions...
    }

我无法调用初始化函数。这个功能有一定的范围吗?我可以只在主函数内调用它吗?我可以在外部JavaScript文件中调用它吗?

$('#fe_reset').click(function () {
    $('#divTextArea').remove(); 
    var textareadiv = document.createElement('div');
    textareadiv.className = 'formula_editor_textarea';
    textareadiv.id = 'divTextArea';
    var thetextarea = document.createElement('textarea');
    thetextarea.className = 'mathdoxformula';
    thetextarea.id = 'formula1'; 
    thetextarea.style.rows = '10';
    thetextarea.style.cols = '80';
    textareadiv.appendChild(thetextarea);
    document.getElementById('formula_editor_container').insertBefore(textareadiv, document.getElementById('fe_cancel'));

        initialize(thetextarea); // CAN I NOT CALL IT LIKE THIS?

    $('#fe_save').css({'cursor': 'default', 'opacity': '0.55'}).attr('disabled','disabled');
});

0 个答案:

没有答案