重置Internet Explorer 9后无法获得正确的结果

时间:2012-04-13 01:30:04

标签: javascript internet-explorer-9

我已经制作了一个上传图片的功能,但当我重置IE9浏览器时,我的功能无法正常工作

//for internet explore browser
function checkLength_forIE(node)
{
    if(node.behaviourUrns.length > 0) //this line give me image is attached or not
  {
      if (document.getElementById) {
        if (!clicked) {
          clicked = true;
          return true;
        } else {
          return false;
        }
      } else {
        return true;
      }
  }
}  

在我获取上传文件数组之后,当我重置IE9浏览器时,请给我正确的解决方案吗? 或者在IE9中获取上传文件详细信息的任何其他方式?

1 个答案:

答案 0 :(得分:0)

一个问题是您拼错了 behaviorUrns

您的代码的一些建议:

//for internet explore browser 
function checkLength_forIE(node) {

  // To keep safe in other browsers, check for beahviorUrns first
  if (node && node.behaviorUrns && node.behaviorUrns.length) {

    // What is the purpose of this line? I think you need to go back to
    // IE 4 to not have getElementById. In anycase, it is a bad inference,
    // test the property you are actually looking for.
    if (document.getElementById) {

      if (!clicked) {
        clicked = true;
        return true;

      } else {
        return false;
      }

    } else {
       return true;
    }
  }
}