【转载】html文本框(input)不保存缓存记录

来源:互联网 发布:淘宝兴趣人群海报 编辑:程序博客网 时间:2024/06/05 07:09

html文本框(input)不保存缓存记录

有的时候js往文本框里赋值,结果在火狐中刷新后,刚才赋的值还在,导致好多麻烦的事情,现总结一下解决办法如下:

<input name="bestlovesky"  type="hidden"  id="bestlovesky" AUTOCOMPLETE="off"    value="" />

上面是一种情况,再就是有的时候一个表单提交后,再回来输入会缓存有以前的记录,像这解决办法如下:

 <script> 
  function   fnSaveForm(){ 
       window.external.AutoCompleteSaveForm(oForm); 
        oForm.input_one.value=""; 
        oForm.input_two.value=""; 
  } 
  </script> 
  <form name="oForm">  
  文本框一(保存): 
  <input  type="text"  name="input_one">  
  文本框二(不保存): 
  <INPUT   TYPE="text"   NAME="input_two"   AUTOCOMPLETE="off"> 
  </FORM> 
  <INPUT   TYPE=button   VALUE="提交"   onclick="fnSaveForm()">


 


如上图所示,在新密码的输入框中本来没有给它添加内容,它确自动默认添加了内容,如何把它去掉呢?
我在head头中加上了如下代码:
<meta   http-equiv= "Pragma"   content= "no-cache" />
<meta   http-equiv= "Cache-Control"   content= "no-cache" />
<meta   http-equiv= "Expires"   content= "0" /> 
结果,问题解决了。

0 0