Det får du så her :)
<script language="JavaScript">
function GemPos (textEl) {
if (textEl.createTextRange)
textEl.caretPos = document.selection.createRange().duplicate();
}
function IndsetVedPos (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 = textEl.value + text;
}
return true;
}
function Kommando(which, action) {
var revisedMessage;
var currentMessage = document.test.textbox.value;
if (action == "test1") {
IndsetVedPos(document.test.textbox, "TEST1");
document.test.textbox.focus();
return;
}
if (action == "test2") {
IndsetVedPos(document.test.textbox, "TEST2");
document.test.textbox.focus();
return;
}
if (action == "link") {
lnk = prompt("Indtast link (url)","
http://")
txt = prompt("Indtast text til link","Indtast her")
IndsetVedPos(document.test.textbox, "[URL=" + lnk + "]" + txt + "[/URL]");
document.test.textbox.focus();
return;
}
}
</script>
<form action="" method="post" name="test">
<TEXTAREA class=ip-textarea onkeyup=GemPos(this); onclick=GemPos(this); name=textbox rows=13 wrap=VIRTUAL cols=50></TEXTAREA>
<br>
<IMG SRC="URL TIL BILLEDE" alt="Indsæt Test1" STYLE="CURSOR: hand" onclick="Kommando(this.form, 'test1');">
<IMG SRC="URL TIL BILLEDE" alt="Indsæt Test2" STYLE="CURSOR: hand" onclick="Kommando(this.form, 'test2');">
<IMG SRC="URL TIL BILLEDE" alt="Opret et link" STYLE="CURSOR: hand" onclick="Kommando(this.form, 'link');">
<br>
</FORM>