Konnex
25.02.2002, 22:01
Hi Folks.
Ich habe folgenden Code :
// vom User markierten Text lesen
function getActiveText() {
if (window.getSelection) text =window.getSelection();
else if (document.getSelection) text =document.getSelection();
else if (document.selection) text =document.selection.createRange().text;
}
// Cursor speichern
function storeCaret(text) {
if (text.createTextRange) {
text.caretPos = document.selection.createRange().duplicate();
}
}
function AddText(text) {
if (document.postmodify.message.createTextRange && document.postmodify.message.caretPos) {
var caretPos = document.postmodify.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ´ ´ ?
text + ´ ´ : text;
}
else document.postmodify.message.value += text;
}
Wie ihr unschwer erkennen könnt ist das für ein Board um das mit den UBBC-Buttons zu realisieren.
Mit dem IE funktioniert das ohne Probleme, aber leider nicht bei Opera und NS 6.2.
Kann mir jemand einen Tip geben, wie ich das auch für obige Browser realisieren kann ?
Gruß Konnex.
Ich habe folgenden Code :
// vom User markierten Text lesen
function getActiveText() {
if (window.getSelection) text =window.getSelection();
else if (document.getSelection) text =document.getSelection();
else if (document.selection) text =document.selection.createRange().text;
}
// Cursor speichern
function storeCaret(text) {
if (text.createTextRange) {
text.caretPos = document.selection.createRange().duplicate();
}
}
function AddText(text) {
if (document.postmodify.message.createTextRange && document.postmodify.message.caretPos) {
var caretPos = document.postmodify.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ´ ´ ?
text + ´ ´ : text;
}
else document.postmodify.message.value += text;
}
Wie ihr unschwer erkennen könnt ist das für ein Board um das mit den UBBC-Buttons zu realisieren.
Mit dem IE funktioniert das ohne Probleme, aber leider nicht bei Opera und NS 6.2.
Kann mir jemand einen Tip geben, wie ich das auch für obige Browser realisieren kann ?
Gruß Konnex.