Un detalle el codigo !!!!
Código HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin título</title>
<script languaje="javascript">
function codigo(numero) {
etiquetas = new Array('<span class="negrita">','<span>','[i]','[/i]','[u]','[/u]');
seleccion = document.selection.createRange().text;
if (seleccion) {
document.selection.createRange().text = etiquetas[numero] + seleccion + etiquetas[numero+1];
form1.texto.focus();
seleccion = '';
return;
}
else {
insertar.mensaje.value += etiquetas[numero] + "texto" + etiquetas[numero+1] + " ";
form1.texto.focus();
return;
}
}
</script>
<style type="text/css">
<!--
.negrita {
font-weight: bold;
}
.ítalica {
font-style: oblique;
}
.tamaño_chico {
font-size: 9px;
}
.tamaño_mediano {
font-size: 10px;
}
.tamaño_grande {
font-size: 12px;
}
.rojo {
color: #FF0000;
}
.negro {
color: #333333;
}
.celeste {
color: #66CCFF;
}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="">
<textarea name="texto" cols="60" rows="10" id="texto"></textarea>
<input type="button" value="Negrita" onClick="codigo(0)">
</form>
</body>
</html>