2012-04-13 76 views
0

我不得不做出一個功能上傳圖像,但是當我在那個時候重置IE9布勞爾我的功能不能正常工作重置Internet Explorer 9中後不能得到正確的結果

//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中上傳的文件詳細信息?

回答

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; 
    } 
    } 
} 
+0

這個函數的我ProblemL目的是,如果用戶已經上傳了照片返回true。我找不到任何方法來知道用戶是否已經上傳圖片。我發現上傳圖片時node.behaviorUrns.length發生了變化。但是,在用戶重置IE9設置後,這不起作用。如果有另一種更好的方式來查找用戶是否上傳了圖片(照片),我需要幫助。 – 2012-04-13 12:42:42