<html>
<head>
<title>首页</title>
<SCRIPT src="js/hanshu.js" type=text/javascript></SCRIPT>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<style>
#menu {
list-style: none;
padding: 0;
margin-left:280px;
width: 774px;
height: 210px;
background: url(images/menu-bg.jpg) no-repeat;
position: relative;
}
#menu span {
display: none;
position: absolute;
}
#menu a {
display: block;
text-indent: -900%;
position: absolute;
outline: none;
}
#menu a:hover {
background-position: left bottom;
}
#menu a:hover span{
display: block;
}
#menu .home {
width: 144px;
height: 58px;
background: url(images/home.gif) no-repeat;
left: 96px;
top: 73px;
}
#menu .home span {
width: 86px;
height: 14px;
background: url(images/home-over.gif) no-repeat;
left: 28px;
top: -20px;
}
#menu .about {
width: 131px;
height: 51px;
background: url(images/about.gif) no-repeat;
left: 338px;
top: 97px;
}
#menu .about span {
width: 40px;
height: 12px;
background: url(images/about-over.gif) no-repeat;
left: 44px;
top: 54px;
}
#menu .rss {
width: 112px;
height: 47px;
background: url(images/rss.gif) no-repeat;
left: 588px;
top: 94px;
}
#menu .rss span {
width: 92px;
height: 20px;
background: url(images/rss-over.gif) no-repeat;
left: 26px;
top: -20px;
}
.img1
{
background:url(images/beijing.jpg);
width:600px;
height:250px;
margin-left:350px;
margin-top:0px;
}
.img2
{
background:url(images/beijing2.jpg);
width:600px;
height:250px;
margin-left:350px;
margin-top:0px;
}
.img3
{
background:url(images/beijing3.jpg);
width:600px;
height:250px;
margin-top:0px;
margin-left:350px;
}
.imgf
{
background:url(images/button.jpg)no-repeat left top;
width:114px;
height:46px;
}
.move
{
padding-top:70px;
}
.mve
{
padding-left:80px;
}
</style>
<script>
function getCookieVal (offset)
{
var endstr = window.document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = window.document.cookie.length;
return unescape(window.document.cookie.substring(offset, endstr));
}
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = window.document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (window.document.cookie.substring(i, j) == arg) return getCookieVal (j);
i = window.document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function showpassword()
{
var p=GetCookie(document.getElementById("username").value);
if(p!=null)
document.getElementById("password").value= p;
}
function SetCookie (name, code)
{
var exp = new Date();
exp.setTime(exp.getTime() + (14*24*60*60*1000));
window.document.cookie = name + "=" + escape (code) + "; expires=" + exp.toGMTString()+";path=/";
}
function remember()
{
if(document.getElementById("remember").checked){
SetCookie(document.getElementById("username").value,document.getElementById("password").value);
alert("saved!");
}
else{alert('请先点击记住密码,再注册')}
}
function DeleteCookie (name)
{
var exp = new Date();
exp.setTime (exp.getTime() - 100);
var cval = GetCookie (name);
window.document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString()+";path=/";
alert("delete!");
}
function DelCookie()
{
DeleteCookie(document.getElementById("username").value);
}
function login()
{
var j=GetCookie(document.getElementById("username").value);
if(document.getElementById("username").value==0)
alert("账号不能为空");
else
{
if(j==document.getElementById("password").value)
window.open("photo.html");
else alert("密码错误");
}
}
</script>
</head>
<body onLoad="startTime()">
<div class="lanrentuku">
<img src="images/beijing.jpg"id="one" onClick="updateImg1(this.id)" >
<img src="images/beijing2.jpg"id="two" onClick="updateImg2(this.id)" >
<img src="images/beijing3.jpg"id="three" onClick="updateImg3(this.id)" >
</div>
<div id="txt"class="f"></div>
<ul id="menu">
<li><a href="index.html" class="home">Home<span></span></a></li>
<li><a href="#" class="about">About<span></span></a></li>
<li><a href="#" class="rss">RSS<span></span></a></li>
</ul>
<br />
<div id="wuha" class="img1">
<div class="move">
<f>请输入用户名:</f><input type="text" id = "username" onBlur="showpassword()">
<input value="注册" type="button" onClick="remember()">
<input value="注销" type="button" onClick="DelCookie()"><br>
<f>请输入密码:</f> <input type="password" id="password"> <input type="checkbox" name = "remember" id="remember">记住密码 <br>
<div class="mve">
<input type="button" class="imgf"onClick="login()">
<f class="asd"><a href="part1.html">忘记密码</a></f>
</div>
</div>
</div>
</body>
</html>