post.asp页面
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function SetCookie(name,value)
{
document.cookie=name+"="+escape(value);
path="/" ;
}
</script></head>
<body>
<a href="read.asp" id="1" onClick="SetCookie('aid',this.id)">1</a><br /><br />
</body>
</html>
read.asp页面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function GetCookie(name)
{
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"))
if(arr != null) return unescape(arr[2]);
else return null;
}
alert(GetCookie('aid'));
window.οnlοad=function(){ document.getElementById("test").value=GetCookie('aid');}
</script>
</head>
<body>
<label>
<form name="form1" method="post" action="" id="form1">
<input type="text" name="textfield" id="test" value=""/>
</form>
</label>
</body>
</html>
是通过id传值,缺点是缓存不能及时清除。