473,480 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Trying to duplicate createTextRange functions

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, -

Jul 14 '06 #1
3 8695
la***********@zipmail.com said the following on 7/14/2006 10:45 AM:
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()
There aren't any.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 14 '06 #2
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
Jul 16 '06 #3
RobG wrote:
[...]
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:
I tested 1.5.0.4 on Windows and it's broken too. It appears to be fixed
in the latest nightly build, I don't know when that will make it into
the production version - maybe wait for 2.0?

<URL:http://wiki.mozilla.org/Firefox:2.0_Product_Planning>
--
Rob
Jul 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2712
by: Frances | last post by:
Hi All, I'm having a problem trying to add a record to a simple Access 2000 db (db is very similar to an address book but with more info than the usual address, phone, etc.). The database is...
0
1168
by: Michael SL | last post by:
First what I want to accomplish. I have implemented a "Find" into a TextArea but I want the user to be able to reposition the "Find" start point by clicking into the TextArea. I am using Visual...
2
2737
by: Jeff Bohmer | last post by:
I have a table in a PG 7.4.1 database with 380 duplicate rows, including duplicate oid and primary key values. Looking through our backups, the duplicates did not exist before Friday, 02/06/2004. ...
2
7667
by: news | last post by:
I just upgraded to PHP 4.4.2 on my Slackware 10.2 system. And Apache/mySQL/PHP all work great through a browser. No errors. But when I try to run a PHP script through the command line, which I...
4
3131
by: wanwan | last post by:
Hi, I have a project with multiple c files. Some of these modules have functions that have the same name and their operations are exactly the same. My rusty memory tells me there is a way...
2
1331
dmjpro
by: dmjpro | last post by:
i could do it by google. but it would be better to have a link from the experts. i m looking for a good link on obj.createTextRange plz send. kind regards.
3
3435
by: buss123 | last post by:
Hi all , we are getting the spellcheck suggestions from other JAR S(APPLET CODE ) . This application is working fine in IE but the same code is not working in Firefox. can any one...
11
4654
by: mdh | last post by:
I decided to make a single file containing all the repetitive functions in K&R so that I could concentrate on the new discussions. This went along just fine, and with each new function, added the...
5
10472
by: gsuns82 | last post by:
the following code works fine in IE6 but does not work in Mozilla,any idea to fix this cross browser issue??? Code PastedText = document.getElementById("hiddenText").createTextRange(); ...
0
7033
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6903
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6726
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4763
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4468
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
557
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.