node2:/var/www/html/js#cat h7.html
<input type="text" id="address" value="请输入邮箱地址"/>
<input type="text" id="password" value="请输入邮箱密码"/>
<input type="button" value="登录"/>
<script type="text/javascript" src="jquery-2.2.2.min.js"></script>
<script type="text/javascript" src="h7.js"></script>
node2:/var/www/html/js#
node2:/var/www/html/js#cat h7.js
$("#address").focus(function(){
var txt_value = $(this).val() ;// 获取地址文本框的值
console.log('aaaaaaaaaaaaaaaaa');
console.log(txt_value);
console.log('aaaaaaaaaaaaaaaaa');
if (txt_value == "请输入邮箱地址"){
$(this).val("");
}
});
$("#address").blur(function(){
var txt_value = $(this).val() ;// 获取地址文本框的值
console.log('aaaaaaaaaaaaaaaaa');
console.log(txt_value);
console.log('aaaaaaaaaaaaaaaaa');
if (txt_value == ""){
$(this).val("请输入邮箱地址");
}
});