html5支持<input type="text" placeholder="手机/邮箱">这个东西,当然js也可以实现,使用onfocus和onblur事件,不晓得事件名写错没有哈,去判断是否输入框的值是否等于手机/邮箱来实现特效,第一种边框颜色就是使用onfocus事件去修改边框的border的color,怎么实现就不帮你写了,家里新机没装Google浏览器写代码不方便,
调试欢乐多
以上是HTML代码,下面是jQuery代码:$("#test").focusin(function(){
$(this).css({"border-color":"#104E8B"});
}).focusout(function(){
$(this).css({"border-color":"#6B6464"});
});
主要是偷懒不想写dom代码
$("#test").focusin(function(){
$(this).css({"border-color":"#104E8B"});
if( $(this).val()="手机/邮箱"){
$(this).val("");
}
}).focusout(function(){
$(this).css({"border-color":"#6B6464"});
if( $(this).val()=""){
$(this).val("手机/邮箱");
}
});