JS : onselectstart

最近的工作中,接触JS的比较多,碰到个文本框不能拖动选择的问题
发现原来是增加了一个函数
document.onselectstart = function(event) {return false};

那么页面上的所有的选择事件将失效。
譬如我们可以指定哪些是不能选定的
document.onselectstart= function(event){return test()};

function test(){
var the = event.srcElement ;
if( !( ( the.tagName== "INPUT" && the.type.toLowerCase() == "text" ) || the.tagName== "TEXTAREA" ) )
{
return false;
}
return true ;

}

你可能感兴趣的:(JS/CSS)