T
Thomas
Hi dudes,
I have a range object for text (not the one in the IE, the one for
Mozilla). Now I have a function to reduce/move the range in the text
to the LEFT, e.g.:
range.setStart(range.startContainer, startPos-1);
range.setEnd(range.endContainer, endPos-1);
range ist the range object created via
window.getSelection.getRangeAt(0).
Now I have the problem to extend or simply move the range to the
RIGHT.
range.setEnd(range.endContainer, endPos + 1);
range.setStart(range.startContainer, startPos + 1);
I thought I could simply switch the sign, but this doesn't work, I get
the following error (yes, I exchanged the order for expanding, so that
first the endContainer is moved and afterwards the startContainer ;-)
):
Error: [Exception... "Index or size is negative or greater than the
allowed amount" code: "1" nsresult: "0x80530001
(NS_ERROR_DOM_INDEX_SIZE_ERR)" location: "xxx.html Line: 79"]
Source File: xxx.html
Line: 79
Thx for any help,
Thomas
I have a range object for text (not the one in the IE, the one for
Mozilla). Now I have a function to reduce/move the range in the text
to the LEFT, e.g.:
range.setStart(range.startContainer, startPos-1);
range.setEnd(range.endContainer, endPos-1);
range ist the range object created via
window.getSelection.getRangeAt(0).
Now I have the problem to extend or simply move the range to the
RIGHT.
range.setEnd(range.endContainer, endPos + 1);
range.setStart(range.startContainer, startPos + 1);
I thought I could simply switch the sign, but this doesn't work, I get
the following error (yes, I exchanged the order for expanding, so that
first the endContainer is moved and afterwards the startContainer ;-)
):
Error: [Exception... "Index or size is negative or greater than the
allowed amount" code: "1" nsresult: "0x80530001
(NS_ERROR_DOM_INDEX_SIZE_ERR)" location: "xxx.html Line: 79"]
Source File: xxx.html
Line: 79
Thx for any help,
Thomas