IE Javascript Error : Object doesn’t support this property or method

Had this strange issue , where a piece of Javascript worked fine in all the browser  ans as usual bar IE :) …  Simple it was, but since the script was not written by me, It took a while to debug this “Object doesn’t support this property or method” error that only IE was throwing up. Probably! If  I were to write the script, I wouldn’t have got this error at all , as do not mix my variable names with field Ids:).

Problem: Object doesn’t support this property or method (on line 3)


function funzoneSP(){
    document.getElementById('video_id').style.visibility="hidden";
    shortdesc = document.getElementById('shortdesc').value;
    ....
}

Solution:
The error is generated on the thirdrow in the example above(Line 3… “shortdesc = document.getE….”). I tried all sort of stupid things , that I dont is even worth the mention here and finally guess what!  just changing the shortdesc var to something else got rid of the error. Basically! The variable name had to different from the fieldID


One Response to “IE Javascript Error : Object doesn’t support this property or method”

  • Ben Roberts Says:

    This was a great tip on a very bizarre issue which I also observed in IE8/IE9. Firefox, Chrome, Safari and nearly every other browser under the sun worked as expected.

    .
    .
    .
    // Resulted in “Object doesn’t support this property or method” sometimes
    frm_req = $(‘frm_req’);
    .
    .
    .

    .
    .
    .
    // Fixed the issue by using a variable name different from the element ID value
    frm_req_1 = $(‘frm_req’);
    .
    .
    .

    My test/use case:
    Prototype 1.7.0.0
    IE8

Leave a Reply

 
NDK home | Expressing IT | Expressing Palate | Expressing Penmenship | Expressing Awe | Expressing Myself