var text_selection="";
function tag_insert(tag,assistent)
{
if(assistent=="no" && document.selection)
{
text_selection=document.selection.createRange();
text_selection.text="["+tag+"]"+text_selection.text+"[/"+tag+"]";
}
else if(assistent=="yes" && tag=="b")
{
text=prompt("Bitte um Eingabe des Textes, der fett dargestellt werden soll.","")
if(text!="" && text!=null)
window.document.posting.elements["Message"].value+="[b]"+text+"[/b]";
}
else if(assistent=="no")
{
window.document.posting.elements["Message"].value+="["+tag+"][/"+tag+"]";
tag_last=tag;
}
window.document.posting.elements["Message"].focus();
}
Für den Mozilla + Netscape habe ich auch einen Code gefunden, abee dieser scheint nicht so richtig zu funktionieren.
if(assistent=="no" && window.getSelection)
{
text_selection=window.getSelection().toString();
text_selection="["+tag+"]"+text_selection+"[/"+tag+"]";
}
else if(assistent=="no" && document.getSelection)
{
text_selection=document.getSelection();
text_selection="["+tag+"]"+text_selection+"[/"+tag+"]";
}