Be warned, it disables the text selection for the whole browser window, so you have to conditionally renable it when you want it.
Event.observe(window,'load',function(e){
if(Prototype.Browser.IE)
{
$$('input, select, textarea')
.invoke('observe','blur',function(e){
disableIETextSelection();
})
.invoke('observe','click',function(e){
enableIETextSelection();
})
.invoke('observe','focus',function(e){
enableIETextSelection();
});
disableIETextSelection();
}
});
function disableIETextSelection()
{
document.body.ondrag = function () { return false; };
document.body.onselectstart = function () { return false; };
}
function enableIETextSelection()
{
document.body.ondrag = null;
document.body.onselectstart = null;
}
No comments:
Post a Comment