关于一个注册邮箱的demo

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
 2 "http://www.w3.org/TR/html4/strict.dtd">
 3 
 4 <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
 5     <head>
 6         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 7         <title>val_test</title>
 8         <meta name="author" content="Administrator" />
 9         <script type="text/javascript" src="script/jquery-1.12.2.js"></script>
10         <!-- Date: 2016-03-23 -->
11     </head>
12     <body>
13         <input type="text" id="address" value="请输入邮箱地址" />
14         <input type="text" id="password" value="请输入邮箱密码" />
15         <input type="button" value="登录" />
16         <script type="text/javascript">
17             $("#address").focus(function() {
18                 var txt_value = $(this).val();
19                 if(txt_value=="请输入邮箱地址"){//或者用defaultValue。
20                     $(this).val("");
21                 }
22             });
23             
24             $("#address").blur(function() {
25                 var txt_value = $(this).val();
26                 if(txt_value==""){
27                     $(this).val("请输入邮箱地址");
28                 }
29             });
30             
31                 $("#password").focus(function() {
32                 var txt_value = $(this).val();
33                 if(txt_value=="请输入邮箱密码"){
34                     $(this).val("");
35                 }
36             });
37             
38             $("#password").blur(function() {
39                 var txt_value = $(this).val();
40                 if(txt_value==""){
41                     $(this).val("请输入邮箱密码");
42                 }
43             });
44         </script>
45     </body>
46 </html>

 

转载于:https://www.cnblogs.com/Arther-J/p/5309831.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值