la***********@zipmail.com wrote:
Hi,
I am trying to make some IE-only JScript work on Firefox and Safari.
Does anyone know of equivalent methods for these functions?
document.selection.createRange()
document.body.createTextRange()
It is only necessary that any equivalent functions work on the lateset
versions of Firefox and Safari. Thanks, -
There is no direct equivalent, however you should be able to emulate it
using window.getSelection and the range object:
<URL:http://developer.mozilla.org/en/docs/DOM:window.getSelection>
At the bottom of the page that the above URL links to are links to
selection and range.
window.getSelection is DOM 0, it is supported by Safari (I tested 2.0.4)
however I couldn't get it to work using Firefox 1.5.0.4 (Mac OS) even
though the Gecko DOM reference indicates that it should - as soon as you
click on a button, the selection is lost:
<p>Here is some text</p>
<input type="button" value="Show selection" onclick="
if ('function' == typeof window.getSelection){
var t = window.getSelection();
alert(t);
">
--
Rob