Comunque puoi anche lanciarti nell'edizione wysiwyg !!!!
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
//----------- Esegue un comando
function doCommand(aStr) {
document.execCommand(aStr);
document.getElementById('tx1').focus();
} // function doCommand(aStr)
//----------- Fonction d'insertion du code HTML
function createHTML(htmlCode) {
var selectedText = document.selection.createRange();
if (selectedText != null) {
selectedText.pasteHTML(htmlCode);
} // if (!selectedText)
document.getElementById('tx1').focus();
return;
} // createHTML(htmlCode)
//==============================================================================
//-->
</script>
<title>Untitled</title>
</head>
<body>
<table summary="" width="100%">
<tr>
<td bgcolor="gray" unselectable="on"></td>
</tr>
<tr>
<td bgcolor="WHITE">
<DIV name="comment" ID="tx1" unselectable="off" CONTENTEDITABLE onclick="this.focus();"
STYLE="height:300px; width:100%;z-index=100;font-family:verdana;font-size:9pt;float:left;float:right;overflow:auto;">
</DIV>
</td>
</tr>
<tr>
<td bgcolor="gray"></td>
</tr>
</table>
<input type="button" name="b1" unselectable="on" value="G" onclick="doCommand('bold');">
<input type="button" name="b1" unselectable="on" value="I" onclick="doCommand('italic');">
<input type="button" name="b1" unselectable="on" value="Righe" onclick="createHTML('
-------------------------------
');">
<input type="button" name="b1" unselectable="on" value="Break" onclick="createHTML('<hr>
');">
<input type="button" name="b1" unselectable="on" value="html" onclick="alert(tx1.innerHTML);">
<script language="JavaScript" type="text/javascript">
<!--
document.getElementById('tx1').focus();
//-->
</script>
</body>
</html>