输入后当kyeup时调用函数存进cookies

解决方案 »

  1.   


    <script language=javascript>function set()
    {
    var then=new Date()
    var str=document.all.txt1.value
    then.setTime(then.getTime()+60*60*1000)
    document.cookie="cookie1="+ str +";expires="+then.toGMTString()
    }function get()
    {
    var str=new String(document.cookie)
    var cookiehead="cookie1="
    var beginposition=str.indexOf(cookiehead)
    if(beginposition!=-1)
    {
    document.all.txt1.value=str.substring(beginposition+cookiehead.length)
    }
    }
    </script>
    <body onload="get()">
    <input type="text" name=txt1 onkeypress="set">
    </body>
      

  2.   

    只有写进cookie这一种 办法
      

  3.   

    用对应request方法
    <input type="text" name="test" value="<%=request("test")%>" ......>
      

  4.   

    yumenzhe(∮郁闷无限∮) 你这个方法不行吧,你request是不是要提交以后呀?