Usiłuje wstawić na żądanie edytor fckeditor za pomocą DOM. Przy użyciu innerHTML nie ma żadnego problemu.
Dodaje koleje wiersze w tabeli i wstawiam fck
<script type="text/javascript"> function jakas_funkcja(){
var tbl = document.getElementById('table1');
var lastRow = tbl.rows.length - 1;
var row = tbl.insertRow(lastRow);
var cell = row.insertCell(0);
var fck = new FCKeditor("id199");
fck.BasePath = "../../js/fckeditor/" ;
fck.Width = "100%" ;
fck.Height = "80";
fck.ToolbarSet = "Basic" ;
cell.innerHTML = fck.CreateHtml();
}
Nadmienię też że dodania fckeditora przy użyciu php czy czystego js działają bezproblemowo np.
<script type="text/javascript"> var fck = new FCKeditor("ala");
fck.BasePath = "../../js/fckeditor/" ;
fck.Value="Lorem ipsum";
fck.Create();
A oto moje nieudane próby dodania fckeditora przy pomocy DOM
Tutaj cała strona wypełnia mi sie na czarno
<script type="text/javascript"> function jakas_funkcja(){
var tbl = document.getElementById('table1');
var lastRow = tbl.rows.length - 1;
var row = tbl.insertRow(lastRow);
var cell = row.insertCell(0);
var desc_edit = 'var oFCKeditor = new FCKeditor("id199");'+"\n";
desc_edit += 'oFCKeditor.BasePath = "../../js/fckeditor/" ;'+"\n";
desc_edit += 'oFCKeditor.Width = "100%" ;'+"\n";
desc_edit += 'oFCKeditor.Height = "80" ;'+"\n";
desc_edit += 'oFCKeditor.ToolbarSet = "Basic" ;'+"\n";
desc_edit += 'oFCKeditor.Create();'+"\n";
var el = document.createElement('script');
el.setAttribute('type','text/javascript');
el.text = desc_edit;
cell.appendChild(el);
}
a tutaj wpisuje mi sie kod html a nie pojawia sie edytor
screen ->
(IMG:http://img170.imagevenue.com/loc752/th_09841_fck_nodetext_122_752lo.jpg)
<script type="text/javascript"> function jakas_funkcja(){
var tbl = document.getElementById('table1');
var lastRow = tbl.rows.length - 1;
var row = tbl.insertRow(lastRow);
var cell = row.insertCell(0);
var fck = new FCKeditor("id199");
fck.BasePath = "../../js/fckeditor/" ;
fck.Width = "100%" ;
fck.Height = "80";
fck.ToolbarSet = "Basic" ;
var el = document.createTextNode(fck.CreateHtml());
cell.appendChild(el);
}