首先先说一下HTML5的代码只是在原有的XHTML基础上增加了一些新的标签(还有一些新的特性,例如数据库和缓存等特性)
以下为此页面的结构代码:
<!doctype html><html>
<head>
<meta charset="utf-8">
<meta name="revised" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="robots" content="all" />
<title>页面标题</title>
</head>
<body>
<header>
<div></div><!--登陆注册区域-->
</header><!--头部[html5新标签]-->
<nav></nav><!--导航[html5新标签]-->
<div></div><!--banner-->
<div></div><!--左上-->
<div></div><!--右上-->
<div></div><!--左下-->
<div></div><!--右下-->
<footer></footer><!--底部[html5新标签]-->
</body>
</html>
注:以上为页面的大的框架,相对用HTML5新的标签更合理的,全用上了新的带有语义标签。
另外多说一下,[注册登陆]这块在html5的新标签里面没有很合适的语义化的标签,所以依然采用原有的div标签为最合理。html5只是在原有的技术的基础上更细化了,咱在制作代码的过程中没必要必须用HTML5的代码,主要看是否合理,合理的为较合适的。
多说的:不管用XHTML还是HTML5写代码,结构(HTML5)与样式(CSS)尽量要分离!
希望能帮到你!
源码如下<script>
//先查看是否有本地数据(记住密码)
/* function myfunction(){
var email = localStorage.getItem("email")
var password = localStorage.getItem("password")
if(email!=null&&password!=null){
alert("邮箱:"+email+"密码:"+password)
$.ajax({
url : '../servlet/LoginServlet?choose=login',
data : {
email : email,
password : password
},
dataType : 'json',
success : function(data) {
if (data.msg == "") {
alert("用户名或密码错误")
} else {
//登录成功后保存session,如果选择了记住密码,再保
存到本地
//window.location.href ='../index/index.jsp'
}
},
error : function() {
alert("系统错误")
}
})
}else{
//alert("没有信息")
}
}
function saveStorage(){
var email = document.getElementById("email").value
localStorage.setItem("email",email)
var password = document.getElementById("password").value
localStorage.setItem("password",password)
}
function login(){
$.ajax({
url : '../servlet/LoginServlet?choose=login',
data : {
email : $('#loginform input[name=email]').val(),
password : $('#loginform input[name=password]').val()
},
dataType : 'json',
success : function(data) {
if (data.msg == "") {
alert("用户名或密码错误")
} else {
//登录成功后保存session,如果选择了记住密码,再保存到
本地
window.location.href ='../index/index.jsp'
}
},
error : function() {
alert("系统错误")
}
})
}
function reg(){
$.ajax({
url : 'servlet/LoginServlet?choose=reg',
data : {
username : $('#regform input[name=username]').val(),
password : $('#regform input[name=password]').val(),
email : $('#regform input[name=email]').val(),
},
dataType : 'json',
success : function(data) {
if(data.msg == false){
alert("注册失败")
}else{
alert("注册成功请返回登录")
}
},
error : function() {
alert("系统错误")
}
})
} */
$(document).ready(function(){
//读取 localStage 本地存储,填充用户名密码,如果自动登录有值直接跳转
;
//相反,跳转到本页面,等待登陆处理
var storage = window.localStorage
var getEmail = storage["email"]
var getPwd = storage["password"]
var getisstroepwd = storage["isstorePwd"]
var getisautologin = storage["isautologin"]
if("yes" == getisstroepwd)
{
if("yes" == getisautologin)
{
if(( ("" != getEmail) ||(null != getEmail)) &&(("" !=
getPwd) ||(null != getPwd)))