【问题标题】:Captcha reload doesn't work in IE 9验证码重新加载在 IE 9 中不起作用
【发布时间】:2012-09-30 17:46:36
【问题描述】:

我有一个简单的 javascript 函数在 chrome 中完美运行,但在 Internet Explorer 中什么也不做。我不知道为什么。

功能:

function captcha()
{
img = document.getElementById("captcha");
img.src = "captcha.asp";
}

我在 html 中有一个表单,其中是一个带有 onClick 事件的按钮,它调用验证码函数。

【问题讨论】:

  • 你能分享为验证码img标签生成的HTML标记吗?

标签: javascript function captcha reload


【解决方案1】:

一个可能的事情是缓存问题。您是否检查了请求和响应。
尝试在 src url 中添加一个随机参数以避免缓存。

img.src = "captcha.asp&id=12a4";

【讨论】:

    【解决方案2】:

    我找到了一个可以在 chrome、firefox 和 Internet Explorer 中正常运行的解决方案。

    我已将 img 标签放入带有验证码 ID 的 iframe 中,并使用 js 函数重新加载此 iframe。

    document.getElementById("captcha").src=document.getElementById("captcha").src;
    

    问题解决了。

    【讨论】:

      猜你喜欢
      • 2011-10-08
      • 2013-11-19
      • 1970-01-01
      • 2014-04-14
      • 1970-01-01
      • 1970-01-01
      • 2011-10-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多