下面给出JavaScript的代码:
JavaScript代码用来控制Cookie
将上述JavaScript代码拷贝到有Cookie的ASPX文件中,并在此ASPX页面中插入下面的Html代码:
< input type ="button" onclick ="cookieTest.showAll()" value ="read" /> < input type ="button" onclick ="cookieTest.set('a','test',31536000000)" value ="setA" /> < input type ="button" onclick ="settest();" value ="setTest" /> < input type ="button" onclick ="cookieTest.destroy()" value ="clear" /> < input type ="button" onclick ="cookieTest.get('test')" value ="gettest" /> < input type ="button" onclick ="cookieTest.get('a')" value ="geta" /> < input type ="button" onclick ="cookieTest.set('test',1,31536000000) value=" resetTest" /> < input type ="button" onclick ="cookieTest.del('test')" value ="delTest" /> <!-- 为了能在ASP.NET中无语法错误,转载者——刚刚(http://lijigang.cnblogs.com)将上述元素的属性值中增加了双引号,以及元素的结束符[/] -->
本文转自刚刚博客园博客,原文链接:http://www.cnblogs.com/lijigang/archive/2008/12/13/1354301.html,如需转载请自行联系原作者