<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>HTML</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#menu > a").each(function(i){
this.οnclick=function(){
cookie.SET("Aien_currentID",this.id,365);
};
});
var currentID=cookie.GET("Aien_currentID");
alert(currentID);
if(currentID!=null){
$("#" + currentID).css({"background-color":"#eee","color":"red"});
} else {
$("#" + currentID).css({"background-color":"#eee","color":"blue"});
}
});
var cookie={
SET : function(name, value, days) {
var expires = "";
if (days) {
var d = new Date();d.setTime(d.getTime() + days * 24 * 60 * 60 * 1000);
expires = "; expires=" + d.toGMTString();
}
document.cookie = name + "=" + value + expires + "; path=/";
},
GET : function (name) {
var re = new RegExp("(\;|^)[^;]*(" + name + ")\=([^;]*)(;|$)");
var res = re.exec(document.cookie);
return res != null ? res[3] : null;
}
};
</script>
</head>
<body>
<div id="container">
<div id="menu">
<a href="index.html" id="m1">首页</a>
<a href="index.html" id="m2">心情日志</a>
<a href="index.html" id="m3">程序随笔</a>
<a href="index.html" id="m4">资源分享</a>
<a href="index.html" id="m5">艾恩作品</a>
<a href="index.html" id="m6">留言簿</a>
</div>
</div>
</body>
</html>
<html xmlns=" http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>HTML</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#menu > a").each(function(i){
this.οnclick=function(){
cookie.SET("Aien_currentID",this.id,365);
};
});
var currentID=cookie.GET("Aien_currentID");
alert(currentID);
if(currentID!=null){
$("#" + currentID).css({"background-color":"#eee","color":"red"});
} else {
$("#" + currentID).css({"background-color":"#eee","color":"blue"});
}
});
var cookie={
SET : function(name, value, days) {
var expires = "";
if (days) {
var d = new Date();d.setTime(d.getTime() + days * 24 * 60 * 60 * 1000);
expires = "; expires=" + d.toGMTString();
}
document.cookie = name + "=" + value + expires + "; path=/";
},
GET : function (name) {
var re = new RegExp("(\;|^)[^;]*(" + name + ")\=([^;]*)(;|$)");
var res = re.exec(document.cookie);
return res != null ? res[3] : null;
}
};
</script>
</head>
<body>
<div id="container">
<div id="menu">
<a href="index.html" id="m1">首页</a>
<a href="index.html" id="m2">心情日志</a>
<a href="index.html" id="m3">程序随笔</a>
<a href="index.html" id="m4">资源分享</a>
<a href="index.html" id="m5">艾恩作品</a>
<a href="index.html" id="m6">留言簿</a>
</div>
</div>
</body>
</html>