<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.jb200.com/" />
<title>脚 本 学 堂</title>
<style type="text/css">
#divTips{
filter:alpha(opacity=30); /*IE滤镜,透明度50%*/
-moz-opacity:0.3; /*Firefox私有,透明度50%*/
opacity:0.3;/*其他,透明度50%*/
position:absolute;
width:600px;
height:400px;
display:none;
color:green;
z-index:10;
padding:10px;
}
#txtNote{
width:300px;
height:100px;
}
</style>
<script type="text/
javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(function () {
var $txtNote = $("#txtNote");
var $divTips = $("#divTips");
$txtNote.focus(function () {
//置焦点时隐藏
$divTips.hide();
}).blur(function(){
$divTips.toggle($txtNote.val() == "").css({
"left": $txtNote.position().left,
"top" : $txtNote.position().top
});
});
$divTips.click(function () {
$txtNote.focus();
});
$txtNote.blur();
});
</script>
</head>
<body>
留言板:<textarea id="txtNote"></textarea>
<div id="divTips">
脚本 学堂 欢迎您</div>
</body>
</html>