Results 1 to 2 of 2
Jan 24, 2007, 11:28 #1
- Join Date
- Nov 2006
- 0 Post(s)
- 0 Thread(s)
Looking for IE equivalent of range.startContainer / range.endContainer
<html> <body> <p id="p1">Paragraph 1</p> <p id="p2">Paragraph 2</p> <p id="p3">Paragraph 3</p> <p id="p4">Paragraph 4</p> </body> </html>
Say that the selection runs from 'Paragraph 2' to 'Paragraph 4'. The value of startContainer will be the 'Paragraph 2' text node, and I can work back to get the parent paragraph element node (call it 'startNode'). Similarly, I can work back from endContainer to get a paragraph element node (call it 'endNode').
I can then take startNode, endNode and the elements in between, add them to a new div, and put the new div back.
The problem is that I can't find an equivalent for IE. I can't find a way of translating the start and end of the selection to positions in the DOM.
Has anyone else come across a solution? I can't really post my full code as it's part of an unfinished Xinha plugin, but I can post the section that I've written if it makes the problem clearer.
Hope that makes sense, and thanks to everyone that tries to help