锋利jquery----3-10设置和获取HTML,文本和值

来源:互联网 发布:梦幻2卖号网络异常 编辑:程序博客网 时间:2024/06/05 10:57
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>3-10-2-1</title> <!--   引入jQuery --> <script src="../../scripts/jquery-1.3.1.js" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[  $(function(){      $("#address").focus(function(){         // 地址框获得鼠标焦点var txt_value =  $(this).val();   // 得到当前文本框的值if(txt_value=="请输入邮箱地址"){                  $(this).val("");              // 如果符合条件,则清空文本框内容}   });  $("#address").blur(function(){  // 地址框失去鼠标焦点      var txt_value =  $(this).val();   // 得到当前文本框的值if(txt_value==""){                $(this).val("请输入邮箱地址");// 如果符合条件,则设置内容}   })  $("#password").focus(function(){      var txt_value =  $(this).val();if(txt_value=="请输入邮箱密码"){                $(this).val("");}   });  $("#password").blur(function(){      var txt_value =  $(this).val();if(txt_value==""){                $(this).val("请输入邮箱密码");}   })  });  //]]>  </script></head><body>    <input type="text" id="address" value="请输入邮箱地址"/>   <br/><br/><input type="text" id="password" value="请输入邮箱密码"/>  <br/><br/><input type="button" value="登陆"/></body></html> 

0 0