The suggestion reproduced below did not work in my version of Mozilla (Mozilla 1.0.1, build Gecko/20020830).
I added the statement near the end of eventer(): alert("selection start: " + a + "\nselection end: " + b + "\nselected substring: " + val.substring(a,b-a) + "\noriginal string: " + val); The file was put in an htdocs subdirectory of an apache Web server running on my computer, and I loaded the page into Mozilla browser using the URL: http://localhost/xxx_substrings.html After I select a substring, the alert window pops up and according to it, the values of a and b are both 'undefined'. Is it a known bug in Mozilla 1.0.1? Is there anything which I should check in the Web server configuration or whatever? On Thu, 18 Sep 2003, Oded Arbel wrote: > 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; !!!!!!!!!! Here I inserted the alert() call !!!!!!!!!! > 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> --- Omer My opinions, as expressed in this E-mail message, are mine alone. They do not represent the official policy of any organization with which I may be affiliated in any way. WARNING TO SPAMMERS: at http://www.zak.co.il/spamwarning.html ================================================================= 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]