生成地址后面加个js随机参数,url?r=Math.random()

解决方案 »

  1.   

    <img id="checkcode" src="" />
    <input type="button" onclick="document.getElementById('checkcode').src='code.php?r=' + Math.random() "  value="点击查看验证码"  />
      

  2.   

    <img src="captcha.php?t=<?=time() ?>">
      

  3.   

    你在验证码图片生成程序中加入禁止缓存的头
    header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
    header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
    header ("Pragma: no-cache");                          // HTTP/1.0
    就可一劳永逸的解决这个问题,而不必每到使用时去改变url
      

  4.   

    Math.random()已经有了,可是不行,现在代码是:
    <img src="/e/ShowKey/?v=login" name="KeyImg" id="KeyImg" align="absmiddle" onclick="KeyImg.src='/e/ShowKey/?v=login&rm='+Math.random()" title="看不清,换一张" width="70" height="30" alt="" />
      

  5.   

    <img src="/e/ShowKey/?v=login&rm='+Math.random()" name="KeyImg" id="KeyImg" align="absmiddle" onclick="KeyImg.src='/e/ShowKey/?v=login&rm='+Math.random()" title="看不清,换一张" width="70" height="30" alt="" />
    都加上了,也不行