Wednesday, June 01, 2005

Range

In Firefox, what's the IE equivelence of range.select()?

1 comment:

Alex said...

Found it.


if (document.all) {
var range = doc.body.createTextRange();
range.moveToElementText(node);
range.select();
} else {
var sel = doc.getSelection();
var range=doc.createRange();
range.selectNode(node);
sel.removeAllRanges();
sel.addRange(range);
}