表单焦点时 使的其为空格时,异常,请大神帮看看

蓝with黑 2015-08-19 07:41:09
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();
}
}
}
}

...全文
44 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

87,955

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧