On Thursday 18 September 2003 00:14, Omer Zak wrote:

> 4.
> http://www.tek-tips.com/gpviewthread.cfm/qid/549806/pid/216/lev2/4/lev3/32
>
>    Insertion of text in middle of textarea - I couldn't figure out
>    how to apply it to my case.  It may have been IE-specific (I need
>    code which works on Mozilla).

Don't understand what's the big deal about. haven't read the above document, 
but if I'd want to replace selected text in a text area, I'd probably do 
something similar to this minimalistic test case (works in Mozilla, doesn't 
in konqi. don't know much about anything else):

<html><head><script>
function eventer(e) {
        if (e.type != "select") {
                alert("not onselect");
                return;
        }
        var mytext = "replaced";
        var a = e.target.selectionStart;
        var b = e.target.selectionEnd;
        var val = e.target.value;
        e.target.value = val.substring(0,a) + mytext + val.substring(b);
}
</script></head><body>
<form>
<textarea id="testy" cols="40" rows="10" onselect="eventer(event);">
This is a long text from which I'm going to select
</textarea>
</form></body></html>

-- 
Oded


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to