标签:txt false alert error event set string remove tar
//判断是否为苹果
var isIPHONE = navigator.userAgent.toUpperCase().indexOf(‘IPHONE‘)!= -1;
// 元素失去焦点隐藏iphone的软键盘
function objBlur(id,time){
if(typeof id != ‘string‘) throw new Error(‘objBlur()参数错误‘);
var obj = document.getElementById(id),
time = time || 100,
docTouchend = function(event){
if(event.target!= obj){
setTimeout(function(){
obj.blur();
document.removeEventListener(‘touchend‘, docTouchend,false);
},time);
}
};
if(obj){
alert("yes IPhone")
obj.addEventListener(‘focus‘, function(){
document.addEventListener(‘touchend‘, docTouchend,false);
},false);
}else{
throw new Error(‘objBlur()没有找到元素‘);
}
}
if(isIPHONE){
var input = new objBlur(‘disTxt‘);
input=null;
}
标签:txt false alert error event set string remove tar
原文地址:http://www.cnblogs.com/seven077/p/7691403.html