473,320 Members | 1,916 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,320 software developers and data experts.

Help on getting mouse position with javascript

4
Hi all,
I am trying to find out a way to get the line in wich the mouse is when browsing a web page. All I could find is the position of the mouse in pixels but that's not what I need.
For example while a user is reading a paragraph I need a script to get which character of the text the reader has selected. I mean in which line of the actual htm file is this character.
Sorry if i'm not very clear.....

Thanks!!!
Sep 24 '07 #1
6 2053
Panos
4
Hello everyone,
I need to find a way to get the line where the mouse is pointing on the browser and then find that position (line number ) in the html file. I believe this is posible with javascript but I can't find out a way to accomplish it.

Thanks!!
Sep 25 '07 #2
gits
5,390 Expert Mod 4TB
hi ...

Threads merged ... please don't double post ... read the posting guidelines ...

kind regards
Sep 25 '07 #3
dmjpro
2,476 2GB
Hello everyone,
I need to find a way to get the line where the mouse is pointing on the browser and then find that position (line number ) in the html file. I believe this is posible with javascript but I can't find out a way to accomplish it.

Thanks!!
Nah!
It is not possible with JavaScript.
Anyway! why are you looking for that :-)

Kind regards,
Dmjpro.
Sep 25 '07 #4
gits
5,390 Expert Mod 4TB
hi ...

it seems to me that you want to retrieve the selected characters on a page?

kind regards
Sep 25 '07 #5
dmjpro
2,476 2GB
If Gits is right then try with document.createTextRange or document.selection

Kind regards,
Dmjpro.
Sep 25 '07 #6
Panos
4
Thank you all for your tips but i'm not that experienced to use document.createTextRange, i'll try it out though. Here is why i need this kind of script:
I want the user to be able to insert his personal comments on an e-book (or something like it).i would prefare to avoid using add ons cause i 'll probably mess it up (not experienced).
So i'm using the WebBrowser component of visual studio 2005, which displays html with javascript properly, and can also add some extra hsndling like next page and so on(it is a desktop application).
What i need is, when a user (for example) right clicks on the text displayed on the browser there would be a pop-up form with a field where he could add some comments. And when a user wants to view his comments they should be placed at the position where he right clicked...Just like if it was a real book...
What i have found is only about how to get the mouse position in pixels.I could use this but it is quite patchwork...
Any ideas??Perhaps with c#??

Thanks allot!!!
Sep 28 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
2
by: reproots | last post by:
hi there, i am having trouble with a span command and would like to know if someone can help me, or point me in the correct direction. basically, i want a little textbox to pop up when a mouse...
3
by: reproots | last post by:
hi there, i am having trouble with a span command and would like to know if someone can help me, or point me in the correct direction. basically, i want a little textbox to pop up when a mouse...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.