Home > Web Front-end > HTML Tutorial > 关于onfocus.onblur的使用_html/css_WEB-ITnose

关于onfocus.onblur的使用_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:42:48
Original
1202 people have browsed it

<input type="text" name="username" size="20" class="login_input"           value="用户名/邮箱"            onfocus="if(value=='用户名/邮箱'){value='';}"           onblur="if(value==''){value='用户名/邮箱'';}"                          />
Copy after login

功能:为了实现用户登入前文本框里的提示信息!
运行时,鼠标放进文本框里时文字会消失,但是鼠标已移开后,文本框里却没有任何显示!为什么呢?


回复讨论(解决方案)

  onblur="if(value==''){value='用户名/邮箱 '';}" 
'多打了一个,用firebug调试吧,这种错误好发现的。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template