Sto creando un pannello che aggiunge automaticamente degli input e dei textareas alla pagina. Riguardo le textareas utilizzo tiny_mce come editor ma ho dei problemi quando cerco aggiungere textareas in modo dinamico: quando faccio partire la funzione "createInput2" la textarea viene aggiunta ma non me la converte nell'editor di testo.Grazie in anticipo.
Ecco il codice:

<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "safari,pagebreak,style,layer,table,save,advhr,adv image,advlink,emotions,iespell,inlinepopups,insert datetime,preview,media,searchreplace,print,context menu,paste,directionality,fullscreen,noneditable,v isualchars,nonbreaking,xhtmlxtras,template",

// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,striketh rough,|,justifyleft,justifycenter,justifyright,jus tifyfull,styleselect,formatselect,fontselect,fonts izeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,repla ce,|,bullist,numlist,|,outdent,indent,blockquote,| ,undo,redo,|,link,unlink,anchor,image,cleanup,help ,code,|,insertdate,inserttime,preview,|,forecolor, backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,s up,|,charmap,emotions,iespell,media,advhr,|,print, |,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,s tyleprops,|,cite,abbr,acronym,del,ins,attribs,|,vi sualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,

// Example content CSS (should be your site CSS)
content_css : "css/content.css",

// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",

// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
</script>
<script type="text/javascript">

var arrInput = new Array(0);
var arrInputValue = new Array(0);
var arrInputValue1 = new Array(0);

function addInput(){
arrInput.push(arrInput.length);
arrInputValue.push("");
arrInputValue1.push("");
display();
}

function display(){
document.getElementById('tab_ingredienti_add').inn erHTML = "";
for (intI = 0; intI < arrInput.length; intI++) {
document.getElementById('tab_ingredienti_add').inn erHTML += createInput(arrInput[intI], arrInputValue[intI], arrInputValue1[intI]);
}
}

function saveValue(intId, strValue){
arrInputValue[intId] = strValue;
}

function saveValue1(intId, strValue){
arrInputValue1[intId] = strValue;
}

function createInput(id, value, value1){
return "[img]ingredienti.png[/img]Ingrediente n°"+id+" <% Set conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=xxxxx;Database=xxx;Uid=xxxx;Pwd=xxx xx;"
sSql = "SELECT * FROM ingredientiricetta ORDER BY ingrediente"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sSql, conn, 3, 3%><select name='ingrediente" + id + "' id='ingrediente" + id + "' onChange='saveValue(" + id + ",this.value)'><% If rs.EOF=True Then %><option value='' selected='selected'>Nessuna categoria</option><%Else%> <option value='' selected='selected'></option><%Do Until rs.EOF %><option value='<%=rs("id")%>'><%=rs("ingrediente")%></option> <%rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
%></select> Commento <input type='text2' size='30' id='commentoingrediente " + id + "' onChange='saveValue1(" + id + ",this.value)' value='" + value1 + "'>
";
}

function deleteInput(){
if (arrInput.length > 0) {
arrInput.pop();
arrInputValue.pop();
arrInputValue1.pop();
}
display();
}
</script>
<script type="text/javascript">

var arrInput2 = new Array(0);
var arrInputValue2 = new Array(0);
var arrInputValue12 = new Array(0);

function addInput2(){
arrInput2.push(arrInput2.length);
arrInputValue2.push("");
arrInputValue12.push("");
display2();
}

function display2(){
document.getElementById('tab_ingredienti_add2').in nerHTML = "";
for (intI2 = 0; intI2 < arrInput2.length; intI2++) {
document.getElementById('tab_ingredienti_add2').in nerHTML += createInput2(arrInput2[intI2], arrInputValue2[intI2], arrInputValue12[intI2]);
}
}

function saveValue2(intId2, strValue2){
arrInputValue2[intId2] = strValue2;
}

function saveValue12(intId2, strValue2){
arrInputValue12[intId2] = strValue2;
}

function createInput2(id2, value2, value12){
return "[img]procedimento.png[/img]Procedimento n°"+id2+"</br><textarea id='procedimento" + id2 + "' name='procedimento" + id2 + "' rows='15' cols='50' style='width: 50%' onChange='saveValue12(" + id2 + ",this.value)'></textarea></br>Immagine <input type='file' name='immagine" + id2 + "' id='immagine" + id2 + "' onChange='saveValue12(" + id2 + ",this.value)' value='" + value12 + "'></br>";
}

function deleteInput2(){
if (arrInput2.length > 0) {
arrInput2.pop();
arrInputValue2.pop();
arrInputValue12.pop();
}
display2();
}
</script>