input标签,输入内容后默认值消失实现方法

<input type="text" value="用户名" class="gray" onclick="if(this.value=='用户名'){this.value='';this.className='black'}" onblur="if(this.value=='') {this.value='用户名';this.className='gray'}" />

猜你喜欢

转载自woai671.iteye.com/blog/2119519