基于html5的注册

1.html页面程序,其中的基于jquery的javascript程序是为了目前支持html5效果不是很好的浏览器设计的。autocomplete=“off”是阻止浏览器的记忆功能。

 

<!DOCTYPE html>

<html lang="en-US">

<head>

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />

        <script type="text/javascript" src="jquery-1.5.2.js"></script>

        <script type="text/javascript" src="jquery.placeholder.js"></script>

        <script type="text/javascript" src="placeholder.js"></script>

        <style type="text/css">

            fieldset{

                width:216px;

            }

            fieldset ol{

                list-style:none;

                padding:0;

                margin:2px;

            }

            fieldset ol li{

                margin:0 0 9px 0;

                padding:0;

            }

            fieldset input{

                display:block;

            }

        </style>

    </head>

<body>

<form id="create_accout" action="/signup" method="post">

<fieldset id="signup">

<legend>账户</legend>

<ol>

<li>

<label for="first_name">first_name</label>

<input type="text" name="first_name" id="first_name" autofocus="true" placeholder="姓"/>

</li>

<li>

<label for="last_name">last_name</label>

<input type="text" name="last_name" id="last_name" placeholder="名"/>

</li>

<li>

<label for="email">email</label>

<input type="email" name="email" id="email" placeholder="user@example.com"/>

</li>

<li>

<label for="password">password</label>

<input type="password" name="password" id="password" value="" autocomplete="off" placeholder="3-10个字符"/>

</li>

<li>

<label for="repassword">repassword</label>

<input type="password" name="repassword" id="repassword" value="" autocomplete="off" placeholder="确认密码"/>

</li>

<li><input type="submit" value="提交"/></li>

</ol>

</fieldset>

</form>

</body>

</html>

 

2.placeholder.js文件内容

$().ready(function(){

  function hasPlaceholderSupport(){

    var element=document.createElement("input");

    return "placeholder" in element;

  }

  if(!hasPlaceholderSupport()){

      $("#create_accout").placeholder();

 

      $("input[autofocus=true]").focus();

  }

})

 

3.图为在firefox与chrome浏览器下的效果


 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值