表单焦点时 使的其为空格时,异常,请大神帮看看
unction resetFields(whichform){
//if(Modernizr.input.placeholder) return;
for(var i=0;i<whichform.elements.length;i++){
var element=whichform.elements[i];
if(element.type=="submit") continue;//是按钮跳过
var check=element.placeholder||element.getAttribute('placeholder');
if(!check) continue;
element.onfocus=function(){
var text=this.placeholder||this.getAttribute('placeholder');
if(this.value==text){
this.className=''; 【为什么我这里Opear焦点在表单里,原来的placeholder会被空格代替?(这里没有打空格)】【safari和chome打开都不能实现?】
this.value='';
}
element.onblur= function () {
if(this.value==''){
this.className="placeholder";
this.value=this.placeholder||this.getAttribute('placeholder');
}
element.onblur();
}
}
}
}