cookie基础与使用
来源:互联网 发布:淘宝网上如何退货 编辑:程序博客网 时间:2024/06/05 09:17
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>记忆表单</title>
<script>
function setCookie(name,value,iDay)
{
var oDate=new Date();
oDate.setDate(oDate.getDate()+iDay);
document.cookie=name+'='+value+';expires='+oDate;
};
function getCookie(name)
{
var arr=document.cookie.split('; ');
for(var i=0;i<arr.length;i++)
{
var arr2=arr[i].split('=');
if(arr2[0]==name)
{
return arr2[1];
}
}
return '';
};
function removeCookie(name)
{
setCookie(name,1,-1);
};
window.onload=function()
{
var oTxt1=document.getElementsByName('user');
var oForm1=document.getElementById('form1');
oForm1.onsubmit=function()
{
setCookie('user',oTxt1.value,14);
};
oTxt1.value=getCookie('user');
};
</script>
</head>
<body>
<form action="http://www.guichuan666.cn/" id="form1">
账号:<input type="text" name="user" /><br />
密码:<input type="password" name="pass" /><br />
<input type="submit" value="提交" id="sub1"/>
</form>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title>记忆表单</title>
<script>
function setCookie(name,value,iDay)
{
var oDate=new Date();
oDate.setDate(oDate.getDate()+iDay);
document.cookie=name+'='+value+';expires='+oDate;
};
function getCookie(name)
{
var arr=document.cookie.split('; ');
for(var i=0;i<arr.length;i++)
{
var arr2=arr[i].split('=');
if(arr2[0]==name)
{
return arr2[1];
}
}
return '';
};
function removeCookie(name)
{
setCookie(name,1,-1);
};
window.onload=function()
{
var oTxt1=document.getElementsByName('user');
var oForm1=document.getElementById('form1');
oForm1.onsubmit=function()
{
setCookie('user',oTxt1.value,14);
};
oTxt1.value=getCookie('user');
};
</script>
</head>
<body>
<form action="http://www.guichuan666.cn/" id="form1">
账号:<input type="text" name="user" /><br />
密码:<input type="password" name="pass" /><br />
<input type="submit" value="提交" id="sub1"/>
</form>
</body>
</html>
0 0
- cookie基础与使用
- Cookie使用基础
- Cookie使用基础
- cookie的基础使用
- Cookie编程基础:限制与编写Cookie
- Cookie编程基础:读取Cookie与Cookie集合
- asp.net与cookie基础
- 会话与状态-Cookie基础
- 会话与状态基础----Cookie
- Cookie认识与使用
- .net Cookie原理与使用
- Yii cookie与session使用
- session与cookie使用区别
- cookie与session使用介绍
- cookie的封装与使用
- php基础之cookie与session
- JS基础——Cookie与存储
- JavaScript的cookie基础与应用
- mysql5.7兼容模式
- 机器学习中的玻尔兹曼分布——最小代价和极大似然
- 不一样的斐波那契
- Problem A: 平面上的点——Point类 (III)
- [LeetCode]75. Sort Colors
- cookie基础与使用
- 二分搜索大法
- spark statistic
- eclipse插件的安装--JavaEE--续--Java与Tomcat服务器的链接
- 递归算法的java实现(取球、全排列、反转串、杨辉三角、AB组合)
- 几种常见窗函数及其MATLAB程序实现
- leetcode第三周解题总结(5,7,66)
- Problem B: 平面上的点——Point类 (IV)
- Ubuntu 14.04 caffe 学习系列一,caffe安装only CPU