473,396 Members | 1,923 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

mouse to return document.range

there are 2 divisions.
there is a word-document loaded in first division.
when the user clicks somewhere in the document, i need some event to
return to me something that is a valid activedocument.range, so i can
select it and work with it.

any ideas???

thank you
mike g

Jul 23 '05 #1
1 1337
mikeg wrote:
there are 2 divisions.
there is a word-document loaded in first division.
? Does this mean you have a Word document loaded using IE and the Word
plugin? If so, why not just use that to edit the document?

On the other hand, if you are trying to copy from the Word document and
paste the content into an HTML page, that is quite different.
when the user clicks somewhere in the document, i need some event to
return to me something that is a valid activedocument.range, so i can
select it and work with it.


Microsoft have implemented document.selection(), which, when combined
with other methods such as createRange, can be used to create an
object. You can then use methods of the range object to do whatever.

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_selection.asp>

You should also Google for window.getSelection(), which appears to be
the DOM equivalent though documentation seems pretty scant.

<URL:http://www.w3.org/TR/MathML2/appendixe.html>

You likely need to use a mix of both methods to get the text, then
create a new object and play with it. Once you get the object into
DOM-space, you should be able to use that to insert it into the web
page in a reasonably cross-browser way.

Quirksmode comes to the party again with an example and information:

<URL:http://www.quirksmode.org/js/selected.html>
There is also a fairly extensive implementation posted here:

<URL:http://groups-beta.google.com/group/comp.lang.javascript/browse_thread/thread/1d3ea102d4978d9a/51e158e6aa8c15bb?q=document.createRange&rnum=1&hl= en#51e158e6aa8c15bb>
--
Rob
Jul 23 '05 #2

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

Similar topics

9
by: punkin | last post by:
I am trying to catch mouse position on the entire screen by dynamically generating mouse click event at every 100 ms. My code only works for IEs but not any Netscape or Gecko-based browsers. The...
7
by: Larry R Harrison Jr | last post by:
I am looking for javascript and a basic tutorial on how to make mouse-over drop-down menus--the type that when you "hover" over a subject links relevant to that subject "emerge" which you can then...
10
by: Danny | last post by:
How can I get the coordinates of the mouse cursor in Mozilla browsers as well as Opera and IE6? I'm struggling to understand how to capture mouse movement events with Mozilla/Netscape/Firefox and...
4
by: Jay | last post by:
Hi, How can I capture mouse position on Image? I found number of script capturing mouse position of the page. But I could not find anything based on image. What I want to find out is X Y...
10
by: windandwaves | last post by:
Hi Gurus I have a little javascript that works perfectly in IE (for a change), but does not work in Firefox and Opera (no errors though)... You can see the script in action at www.tupelo.co.nz...
5
by: gsb | last post by:
I track the mouse location like this code: function mousePos(e) { var p = new Object(); if(e) { p.x = e.pageX; p.y = e.pageY; } else { p.x = event.x; p.y = event.y; } ... (show) }...
5
by: chris | last post by:
I have a bit of JavaScript code (see below) that handles drag-and-drop of elements on a webpage, simply moving them around the page. The problem I'm having occurs when the user drags the object...
2
by: markszlazak | last post by:
In the following script, a control displays (black box) in each table cell once you mouse over the cell. Mouse down on the control to change the mode of the table. Drag the mouse over cells in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.