日期:2014-05-18 浏览次数:20379 次
<!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> <script language="javascript"> function setCookie(name,value) { var Days = 30; var exp = new Date(); //new Date("December 31, 9998"); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); } function test(name) { document.getElementById("t1").value=getCookie(name); } function getCookie(name) { var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)) return unescape(arr[2]); else return null; } </script> </head> <body onload="test('test')"> <textarea id="t1" name="t1" onkeyup="setCookie('test',document.getElementById('t1').value);"></textarea> </body> </html>
------解决方案--------------------
启用javascript记忆功能(写代码)
------解决方案--------------------
最容易实现的方法就是用Session存储你要记忆的东西!