English 中文(简体)
如何从javascript的很少协调点获得或创造选择或范围?
原标题:How does one get or create a selection or range from a dom coordinate point in javascript?

Hopefully this is possible by invoking a method that gets executed by browser internal code. Given a point x,y in dom co或dinates. (that is can get relative to any node) in an element containing text I want effectively

charIndex = characterUnderPoint(textNode,nodex,nodey);

图一

range = xx.creatRange(node,x,y)

selection = xx.createSelection(node,x,y)

range.setAnch或ToLocation(node,x,y)

等等。

迄今为止,我找不到任何东西能够有效地实施你点击确定谨慎立场时所发生的一切。 看来,所有方法都只具有被抵消的性质。

我主要希望这样做,因为通过在所有果园中增加范围以检验点是否非常缓慢(可能是一种双轨搜索,但)应当在本地法典的排外发动机内进行快速检测。

问题回答

这样做并不容易。 <代码>Range 赢得了一定帮助。 它只剩下几个点,被冲抵。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签