62,268
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(".title").focus(function(){
if($(this).val()==$(this)[0].defaultValue)
$(this).css({color:"#ccc",fontStyle:"italic"});
})
$(".title").keydown(function(){
if($(this).val()==$(this)[0].defaultValue)
$(this).val("");
$(this).css({color:"#333",fontStyle:"normal"});
})
})
</script>
</head>
<body>
<input type="text" class="title" value="请输入标题" />
</body>
</html>
function ChangeStyle(obj)
{
obj.style.fontStyle ="italic";
obj.style.color="Gray";
obj.value="你的提示信息";
}
function CLear(obj)
{
if(obj.value=="你的提示信息")
{
obj.value="";
}
}