js如何实现文本框获得焦点时显示文本内容,失去焦点时隐藏
解决方案 »
- 递归实现这个算法
- 关于Button的客户端和服务器端点击事件
- ~网站根目录
- JavaScript调用WebService的缺点?
- 关于NetAdvantage 2007,请赐教
- 在线等,在ASP.NET的日期控件(Calendar),点击日期控件以外区域,隐藏此控件,注意是点击日期控件以外的区域
- 怎么获取sqlserver2000中读数据库的时间和次数啊?
- Nunit测试。。。。
- 一个调试的问题:为什么我的用户进程中没有aspnet_wp进程,在config文件设置了Debug=true还提示我没有设置项目为调试?
- 到北京出差,无聊,散散分!
- 有关tooltip的奇异现象?
- 用JS怎么判断gridview里的checkbox有没有勾上啊?
http://www.google.com.hk/search?q=asp.net+TextBoxWater&hl=zh-CN&newwindow=1&safe=strict&source=lnt&tbs=lr:lang_1zh-CN%7Clang_1zh-TW&lr=lang_zh-CN%7Clang_zh-TW&sa=X&ei=1t7sTMvCGYncvQOizuzRAQ&ved=0CAcQpwU当然几乎任何一种javascript的扩展工具框架包中也都包括这个。
var hot = "模糊条件|姓名|毕业学校|工作经历|证书|职称";
$("#txtSearch").val(hot);
$("#txtSearch").focus(function() {
if ($(this).val() == hot) {
$(this).val("");
}
}).blur(function() {
var content = $(this).val();
if (content == "") {
$(this).val(hot);
}
});
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script language ="javascript" >
function GetIn()
{
document .getElementById ("txt").value = "你的值";
}
function GetOut()
{
document .getElementById ("txt").value = "";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input type ="text" id="txt" onmouseup ="GetIn();" onblur="GetOut();"/>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题页</title>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
function getValue(){
alert(document.getElementById('zzz').value);
}
</script>
</head>
<body>
<input type ="text" id="txt" value="请输入要搜索的条件" onfocus="javascript:if(this.value=='请输入要搜索的条件')this.value=''" onblur="javascript:if(this.value.length==0)this.value='请输入要搜索的条件'"/>
</body>
</html>