看不清楚换一张时,用的是
 <img id="imgCode" alt ="看不清楚请点我" src="drawcaptcha.aspx" onclick="this.src=this.src+'?'"
                  style="cursor: hand; width:90px; height: 30px"  />
               <a href ="javascript:"  onclick ="Change()">看不清楚?换一张</a>
点图片可以换,点超链接不能。
js:<script language="javascript" >
function Change()
{
document.getElementById("imgCode").src ="drawcaptcha.aspx+?";}
</script>我不知道a href 能不能这样用。我换成button 可以。但是 感觉人家都用的a href 啊。怎么用啊

解决方案 »

  1.   

    首先。楼主你单独写个js的函数。document.getElementById("imgCode").src ="drawcaptcha.aspx?i="+Math.random(); 
    就可以了。
      

  2.   

    我有单独的js函数 啊?
    function Change()
    {
    document.getElementById("imgCode").src ="drawcaptcha.aspx+?";}
    这个不对么?
      

  3.   

    参考相关:
    http://www.cnblogs.com/insus/articles/1945539.html
    http://www.cnblogs.com/insus/articles/1425377.html
    http://www.cnblogs.com/insus/articles/1432649.html
      

  4.   

    document.getElementById("imgCode").src ="drawcaptcha.aspx+?";这个应该写成 document.getElementById("imgCode").src ="drawcaptcha.aspx"+"?";
    要不你的地址就是 drawcaptcha.aspx+?,在地址栏肯定是不对的
      

  5.   

    <a href ="javascript:;" onclick ="Changes()">看不清楚?换一张</a>
    <a href ="javascript:Changes()" onclick ="Change()">看不清楚?换一张</a>
    :<script language="javascript" >
    function Changes()
    {
    document.getElementById("imgCode").src ="drawcaptcha.aspx?i="+Math.random(); 
    }
    </script>
      

  6.   

    如果楼主安装了chrome,就按F12,选择network,然后点击哪个 “看不清楚,换一张”,然后看看你的请求是不是准确
      

  7.   


    <img id="imgCode" alt ="看不清楚请点我" src="drawcaptcha.aspx" onclick="Change()"
      style="cursor: hand; width:90px; height: 30px" />
      <a href ="javascript:" onclick ="Change()">看不清楚?换一张</a>
    <script language="javascript" >
    function Change()
    {
    document.getElementById("imgCode").src ="drawcaptcha.aspx"+"?rnd=" + Math.random();
    }
    </script>
      

  8.   

    如果还不行,那就看看你的 drawcaptcha.aspx 是不是有问题