实现文本框获得焦点,文本框里提示信息自动消失
2011-09-19 21:29
393 查看
<html>
<head>
<title>实现文本框获得焦点,文本框里提示信息自动消失 </title>
<link href="css/StyleSheet1.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('#txtArea').focus(function () {
with (event.srcElement)
//如果当前值为默认值,则清空
if (value == defaultValue) value = ""
});
$('#txtArea').blur(function () {
with (event.srcElement)
if (value == "") value = defaultValue
});
});
</script>
</head>
<body>
<textarea id="txtArea" class="txtcss" runat="server" value="填写问题"></textarea>
</body>
</html>
<head>
<title>实现文本框获得焦点,文本框里提示信息自动消失 </title>
<link href="css/StyleSheet1.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('#txtArea').focus(function () {
with (event.srcElement)
//如果当前值为默认值,则清空
if (value == defaultValue) value = ""
});
$('#txtArea').blur(function () {
with (event.srcElement)
if (value == "") value = defaultValue
});
});
</script>
</head>
<body>
<textarea id="txtArea" class="txtcss" runat="server" value="填写问题"></textarea>
</body>
</html>
相关文章推荐
- JS实现文本框获得焦点,文本框里提示信息自动消失
- JS实现文本框获得焦点,文本框里提示信息自动消失
- JavaScript学习笔记3--文本框获得焦点,文本框里提示信息自动消失
- JavaScript学习笔记3--文本框获得焦点,文本框里提示信息自动消失
- JavaScript学习笔记3--文本框获得焦点,文本框里提示信息自动消失
- js实现文本框提示,获得焦点消失!
- jquery 提示信息显示后自动消失的具体实现
- 文本框内默认提示————请输入用户姓名(字体灰色),要求: (1)当文本框获得焦点时,默认提示消失 (2)当文本框失去焦点时,如果没有输入新内容,那么则显示原来的灰色字体内容; 如果有新内容输入则判断,如果长度小于10,则提示“姓名长度应该大于10个字符”
- jQuery, 文本框获得焦点后, placeholder提示文字消失
- ios中提示信息的实现及自动消失
- JavaScript实现文本框中默认显示背景图片在获得焦点后消失的方法
- JavaScript实现文本框中默认显示背景图片在获得焦点后消失的方法
- jquery 提示信息显示后自动消失的具体实现
- 文本框提示样式,鼠标点击获得焦点时提示内容消失
- Jquery 网站保存信息提示消息实现,提示后自动消失
- jQuery实现文本域内提示文字,当鼠标点击进文本域后自动消失,文本域失去鼠标焦点后显示提示文字或显示用户输入的文字。
- 文本框失去焦点有提示信息,文本框获得焦点清空提示信息,并且字体颜色不同
- Jquery 网站保存信息提示消息实现,提示后自动消失
- ios中提示信息的实现及自动消失
- 文本框获得焦点后文本框内的提示文本消失 失去焦点后如果没有输入再显示提示