ho generalizzato lo script in questo modo
per cui se ho una faccina da inserire farò cosicodice:<script type="text/javascript"> <!-- function AddToTextarea(TextareaID,TextToAdd,Titolo,TypeText) { if(TypeText !=""){ var L = prompt(Titolo,""); if (L != "" || null) {TextToAdd= '<' + TypeText + '>' + L + '</' + TypeText + '>'} } var MyTextarea = document.getElementById(TextareaID); if (document.all) { MyTextarea.focus(); var MyRange = document.selection.createRange(); MyRange.colapse; MyRange.text = TextToAdd; } else if (MyTextarea.selectionEnd) { var MyLength = MyTextarea.textLength; var StartSelection = MyTextarea.selectionStart; var EndSelection = MyTextarea.selectionEnd; MyTextarea.value = MyTextarea.value.substring(0, StartSelection) + TextToAdd + MyTextarea.value.substring(EndSelection, MyLength); } else { MyTextarea.value += TextToAdd; } }
domanda: è corretto lasciare alcune cose vuote come sopra? ci ho messo gli apici e basta.codice:[img]../loghi/smile_01.gif[/img]
se ho invece un testo da formattare farò cosi
cosa ne pensate?codice:<input type="button" name="bold" value="B" onclick="AddToTextarea('commento','','Inserisci il testo da fare in grassetto','strong')">

Rispondi quotando