Den er bag admin, men her er koden:
<SCRIPT>
<!--
cb = "";
function kursiv() {
sel = document.selection.createRange();
if (sel.text != ""){
html = "<i>" + sel.text + "</i>";
insertAtCaret(document.form.indhold,html);
}
}
function fed() {
sel = document.selection.createRange();
if (sel.text != ""){
html = "<b>" + sel.text + "</b>";
insertAtCaret(document.form.indhold,html);
}
}
function link() {
sel = document.selection.createRange();
if (sel.text != "") hr = prompt("LINKADRESSE:","
http://www."); //Du kan skifte "
http://" ud med sel.text hvis adressen automatisk skal være den markerede indhold!
else hr = "";
if (hr != "
http://www." && hr != "" && hr != null && sel.text != ""){
html = "<a href=\"" + hr + "\" target=\"_blank\">" + sel.text + "</a>";
insertAtCaret(document.form.indhold,html);
}
}
function storeCaret (textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
function insertAtCaret (textEl, text) {
if (textEl.createTextRange && textEl.caretPos) {
var caretPos = textEl.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
} else textEl.value = text;
}
//-->
</SCRIPT>
<?php
print "
<form method=\"post\" name=\"form\" action=\"admin_univers.php?action=opdater\">
<input type=\"button\" value=\"Fed\" onClick=\"fed();\" style=\"font-weight: bold; font-size: 9px;\" title=\"Markér tekst, som du vil lave fed, og tryk her\">
<input type=\"button\" value=\"Kursiv\" onClick=\"kursiv();\" style=\"font-style: italic; font-size: 9px;\" title=\"Markér tekst, som du vil lave kursiv, og tryk her\">
<input type=\"button\" value=\"Link\" onClick=\"link();\" style=\"font-size: 9px;\" title=\"Markér tekst, som du vil lave til et link, og tryk her\">
<textarea name=\"indhold\" onSelect=\"storeCaret(this);\" onClick=\"storeCaret(this);\" onKeyUp=\"storeCaret(this);\" cols=\"90\" rows=\"30\" style=\"font-family:Tahoma,arial; font-size=11px\">$row[indhold]</textarea> </td>
</form>
";
?>