CreateTextRange is a Microsoft specific function, but there is an easy work around.
Use createRange
instead as in this post for example:
if (document.selection) { //IE
var range = document.body.createTextRange();
range.moveToElementText(document.getElementById(containerid));
range.select();
} else if (window.getSelection) { //others
var range = document.createRange();
range.selectNode(document.getElementById(containerid));
window.getSelection().addRange(range);
}