Can't assign the value of an input element in ID??

Discussion in 'Javascript' started by dave, Apr 7, 2008.

  1. dave

    dave Guest

    IE7 is generating an "object doesn't support this property or
    method.." when i do

    foo = document.getElementById('bar').value;

    however, if I do
    alert(document.getElementById('bar').value); I get the value....

    Is this a known bug or am I missing something?
     
    dave, Apr 7, 2008
    #1
    1. Advertisements

  2. dave

    SAM Guest

    dave a écrit :
    before end of loading or after ?
     
    SAM, Apr 7, 2008
    #2
    1. Advertisements

  3. dave

    dave Guest

    after... the alert works but not the assign
     
    dave, Apr 7, 2008
    #3
  4. dave

    dave Guest

    after... the alert works but not the assign
     
    dave, Apr 7, 2008
    #4
  5. dave

    dave Guest

    After some testing, it became apparent that assigning it to "keywords"
    was causing the error. I guess M$ made up some javascript reserved
    words.
     
    dave, Apr 7, 2008
    #5
  6. This has nothing to do with reserved words. Probably you have an element
    with ID or name `foo' in your document. If you had declared the identifier,
    there would not be such a long scope chain where to find the host object
    whose [[Put]] implementation causes this error:

    var foo = ...;


    PointedEars
     
    Thomas 'PointedEars' Lahn, Apr 8, 2008
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.