![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
02/02/2013, 13:19
|
| | Fecha de Ingreso: diciembre-2012 Ubicación: Castelón
Mensajes: 8
Antigüedad: 12 años, 1 mes Puntos: 0 | |
Respuesta: Div contenteditable="true" con botones Finalmente lo he solucionado, dejo aquí el código por si a alguien le interesa
<html>
<head>
<script>
function inHTML(editor,u){
var u,u2;
try{
document.execCommand("inserthtml",false,u);
}catch(e){
try{
editor.focus();
u2=document.selection.createRange();
u2.pasteHTML(u);
}catch(E){
}
}
return false;
}
</script>
<style>
body {
background-color:#ffffff;
font-family: Palatino Linotype;
font-style: normal;
font-variant: normal;
font-weight: normal;
font-size: 100%;
line-height: 15px;
font-size-adjust: none;
font-stretch: normal;
}
#botones{
width:80%;
height:300px;
font-family: Palatino Linotype;
font-style: normal;
font-variant: normal;
font-weight: normal;
font-size: 100%;
line-height: 4px;
font-size-adjust: none;
font-stretch: normal;
visibility: visible; align:center;
}
#editor{
background-color: #ffffff;
width:80%;
height:200px;
border: 1px solid #666666;
font-family: Palatino Linotype;
font-size: 100%;
text-align:left;
color: #000000;
padding-left:1%;
padding-top:1%;
border-style: double;
border-color: #666666;
overflow: scroll;
scrollbar-face-color: #c7c7c7;
scrollbar-highlight-color: #f4f4f4;
scrollbar-shadow-color: #dfdfdf;
scrollbar-3dlight-color: #dfdfdf;
scrollbar-arrow-color: #dfdfdf;
scrollbar-darkshadow-color: #dfdfdf;
border-bottom: 1px double #666666";
}
</style>
</head>
<form name="f">
<body leftmargin=0 topmargin=0 scroll=no >
<div name="content" autofocus contenteditable="true" id="editor"></div>
<br>
<div id="botones">
<input
style="width: 6%; height: 35px; font-family: Palatino Linotype; font-size: 130%; font-weight: bold;"
value="ζ"
onclick="return inHTML(document.getElementById('editor'),'ζ');"
type="button"><input
style="width: 6%; height: 35px; font-family: Palatino Linotype; font-size: 130%; font-weight: bold;"
value="ω"
onclick="return inHTML(document.getElementById('editor'),'ω');"
type="button">
</form>
</body>
</html> |