输入框点击时边框变色效果的实现方法
实例如下:
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="textml;charset=utf-8"/>
<title>输入框点击时边框变色效果</title>
</head>
<body>
<styletype="text/css">
.focusInput{border:1pxsolid#99CC33;}
</style>
<scripttype="text/javascript">
functionfocusInput(focusClass){
varelements=document.getElementsByTagName("input");
for(vari=0;i<elements.length;i++){
if(elements[i].type!="button"&&elements[i].type!="submit"&&elements[i].type!="reset"){
elements[i].onfocus=function(){this.className=focusClass;};
elements[i].onblur=function(){this.className='';};
}
}
}
window.onload=function(){
focusInput('focusInput');
}
</script>
请输入姓名:<inputtype="text"/>
</body>
</html>
以上就是小编为大家带来的输入框点击时边框变色效果的实现方法全部内容了,希望大家多多支持毛票票~
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短