- var P = "";
- P += "<style>\n";
- P += ".htmleditor { width:%WIDTH%; height:%HEIGHT%; border: outset 1px; padding: 2px; background-color: #dfdfdf; }\n";
- P += ".htmleditor span { width: 100%; height:100%; background-color: white; border: inset 1px; overflow: auto; padding: 2px; margin: 0px; font-face: Verdana; }\n";
- P += ".htmleditor span p { margin: 0px; margin-bottom: 5pt; }\n";
- P += ".htmleditor .btn { padding: 0px; margin: 1px 1px 1px 0px; border: outset 1px; width: 22px; height: 21px; background-color: #cccccc; }\n";
- P += ".htmleditor select { font: xx-small Arial; padding: 0px; margin: 1px 0px 1px 0px; }\n";
- P += ".htmleditor ul, .htmleditor ol { margin-left:20px; }\n";
- P += "</style>\n";
- P += "<script>\n";
- P += "function %ID%CallCommand(cmd, param) {\n";
- P += "document.all.%ID%.focus();\n";
- P += "if(\"FontName\" == cmd || \"FontSize\" == cmd || \"ForeColor\" == cmd) {\n";
- P += "document.execCommand(cmd, true, param);\n";
- P += "} else if(\"InsertImage\" == cmd) {\n";
- P += "document.execCommand(cmd, true, \"\");\n";
- P += "} else if(cmd.length > 0) document.execCommand(cmd);\n";
- P += "}\n";
- P += "</script>\n";
- P += "<span class=htmleditor><table border=0 cellspacing=0 cellpadding=0 width=%WIDTH% height=%HEIGHT%>\n";
- P += "<tr><td><font face=Verdana size=2 color=black><span id=%ID% contentEditable onfocusout='%PARENT%.value=this.innerHTML' style='font-size:85%;'></span></font></td></tr>\n";
- P += "<tr><td height=1%>\n";
- P += "<nobr>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"Bold\")' title=\"Negrita\"><img src='../img/bold.gif' width=17 height=16 border=0></button>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"Italic\");' title=\"Cursiva\"><img src='../img/italic.gif' width=17 height=16 border=0></button>\n";
- P += "<wbr><img src='#' width=1 height=1><wbr>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"JustifyLeft\");' title=\"Alinear a la izquierda\"><img src='../img/left.gif' width=17 height=16 border=0></button>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"JustifyCenter\");' title=\"Centrar\"><img src='../img/center.gif' width=17 height=16 border=0></button>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"JustifyRight\");' title=\"Alinear a la derecha\"><img src='../img/right.gif' width=17 height=16 border=0></button>\n";
- P += "<wbr><img src='#' width=1 height=1><wbr>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"Cut\");' title=\"Cortar\"><img src='../img/cut.gif' width=17 height=16 border=0></button>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"Copy\");' title=\"Copiar\"><img src='../img/copy.gif' width=17 height=16 border=0></button>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"Paste\");' title=\"Pegar\"><img src='../img/paste.gif' width=17 height=16 border=0></button>\n";
- //P += "<wbr><img src='#' width=1 height=1><wbr>\n";
- //P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"Undo\");' title=\"Deshacer\"><img src='../img/undo.gif' width=17 height=16 border=0></button>\n";
- //P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"Redo\");' title=\"Rehacer\"><img src='../img/redo.gif' width=17 height=16 border=0></button>\n";
- P += "<wbr><img src='#' width=1 height=1><wbr>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"InsertOrderedList\");' title=\"Numeración\"><img src='../img/ol.gif' width=17 height=16 border=0></button>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"InsertUnorderedList\");' title=\"Viñetas\"><img src='../img/ul.gif' width=17 height=16 border=0></button>\n";
- P += "<wbr><img src='#' width=1 height=1><wbr>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"Outdent\");' title=\"Reducir sangría\"><img src='../img/outdent.gif' width=17 height=16 border=0></button>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"Indent\");' title=\"Aumentar sangría\"><img src='../img/indent.gif' width=17 height=16 border=0></button>\n";
- P += "<wbr><img src='#' width=1 height=1><wbr>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"InsertHorizontalRule\");' title=\"Insertar línea horizontal\"><img src='../img/hr.gif' width=17 height=16 border=0></button>\n";
- P += "<wbr><img src='#' width=1 height=1><wbr>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"InsertImage\");' title=\"Insertar imagen\"><img src='../img/image.gif' width=17 height=16 border=0></button>\n";
- P += "<wbr><img src='#' width=1 height=1><wbr>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"CreateLink\");' title=\"Insertar enlace\"><img src='../img/a.gif' width=17 height=16 border=0></button>\n";
- P += "<wbr><img src='#' width=1 height=1><wbr>\n";
- P += "<button class=btn unselectable=on onclick='%ID%CallCommand(\"RemoveFormat\");' title=\"Borrar formato\"><img src='../img/new.gif' width=17 height=16 border=0></button>\n";
- P += "<wbr><img src='#' width=1 height=1><wbr><select onchange='%ID%CallCommand(\"FontName\",this[this.selectedIndex].text); this.selectedIndex=0;'>\n";
- P += "<option selected>Fuente</option>\n";
- P += "<option>Arial</option>\n";
- P += "<option>Comic Sans MS</option>\n";
- P += "<option>Courier New</option>\n";
- P += "<option>Garamond</option>\n";
- P += "<option>Georgia</option>\n";
- P += "<option>Tahoma</option>\n";
- P += "<option>Times New Roman</option>\n";
- P += "<option>Trebuchet MS</option>\n";
- P += "<option>Verdana</option>\n";
- P += "</select> <select onchange='%ID%CallCommand(\"FontSize\", this[this.selectedIndex].text);this.selectedIndex=0;'>\n";
- P += "<option>Tamaño</option>\n";
- //P += "<option>-2</option>\n";
- //P += "<option>-1</option>\n";
- //P += "<option>0</option>\n";
- P += "<option>1</option>\n";
- P += "<option>2</option>\n";
- P += "<option>3</option>\n";
- //P += "<option>4</option>\n";
- //P += "<option>5</option>\n";
- P += "</select>";
- //P += " <select unselectable=on onchange='%ID%CallCommand(\"ForeColor\", this[this.selectedIndex].text); this.selectedIndex=0;'>\n";
- //P += "<option selected>Color</option>\n";
- //P += "<option style='background-color: #000000'>#000000</option>\n";
- //P += "<option style='background-color: #880000'>#880000</option>\n";
- //P += "<option style='background-color: #008800'>#008800</option>\n";
- //P += "<option style='background-color: #000088'>#000088</option>\n";
- //P += "<option style='background-color: #888800'>#888800</option>\n";
- //P += "<option style='background-color: #880088'>#880088</option>\n";
- //P += "<option style='background-color: #008888'>#008888</option>\n";
- //P += "<option style='background-color: #888888'>#888888</option>\n";
- //P += "<option style='background-color: #FF0000'>#FF0000</option>\n";
- //P += "<option style='background-color: #00FF00'>#00FF00</option>\n";
- //P += "<option style='background-color: #0000FF'>#0000FF</option>\n";
- //P += "<option style='background-color: #FFFF00'>#FFFF00</option>\n";
- //P += "<option style='background-color: #FF00FF'>#FF00FF</option>\n";
- //P += "<option style='background-color: #00FFFF'>#00FFFF</option>\n";
- //P += "<option style='background-color: #FFFFFF'>#FFFFFF</option>\n";
- //P += "</select> <wbr>\n";
- P += "</nobr>\n";
- P += "</td></tr>\n";
- P += "</table>\n";
- P += "</span>\n";
- P += "<"+"script>\n";
- P += "function timeoutSetValue() {\n";
- P += " %PARENT%.value=document.all.%ID%.innerHTML;\n";
- P += " setTimeout('timeoutSetValue()', 100);\n";
- P += "}\n";
- P += "timeoutSetValue();\n";
- P += "</"+"script>\n";
- //*****************************************************************************
- function str_replace(a, b, s) {
- for(idx = 0; idx < s.length - a.length; idx++)
- if(s.substring(idx, idx+a.length) == a) {
- s = s.substring(0, idx) + b + s.substring(idx + a.length, s.length);
- idx += b.length;
- }
- return s;
- }
- //*****************************************************************************
- function insertHtmlEditor(id, parent, width, height) {
- s = P;
- s = str_replace("%ID%", id, s);
- s = str_replace("%PARENT%", parent, s);
- s = str_replace("%WIDTH%", width, s);
- s = str_replace("%HEIGHT%", height, s);
- document.write(s);
- }
- //*****************************************************************************
- function initHtmlEditor(id, html) {
- if(!html || !html.length) html = '<font face=Verdana size=1 color=black></font>';
- else html = '<font face=Verdana size=2 color=black>'+html+'</font>';
- eval("document.all."+id+".innerHTML = html");
- eval("document.all."+id+".onfocusout();");
- }
Recent Pastes