function bbcode(x) {
y=document.selection.createRange().text;
n=window.prompt("Text der formatiert geschrieben werden soll:",y);
if ((n != null) && (n != "")) {
document.selection.clear();
a=document.gb.text.value;
input('[' + x + ']'+y+'[/' + x + '] ');
}
}
function input(what)
{
if (document.gb.text.createTextRange)
{
document.gb.text.focus();
document.selection.createRange().duplicate().text = what;
}
else if (document.getElementById && !document.all) // Mozilla
{
var tarea = document.forms['gb'].elements['text'];
var selEnd = tarea.selectionEnd;
var txtLen = tarea.value.length;
var txtbefore = tarea.value.substring(0,selEnd);
var txtafter = tarea.value.substring(selEnd, txtLen);
tarea.value = txtbefore + what + txtafter;
}
else
{
document.entryform.text.value += what;
}
}
thx die funktion input hat mir wirklich sehr geholfen mit dem script klappts jetzt wie ich ma des vorstell ;)