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. Advertising

  2. dave

    SAM Guest

    dave a écrit :
    > IE7 is generating an "object doesn't support this property or
    > method.." when i do
    >
    > foo = document.getElementById('bar').value;


    before end of loading or after ?

    --
    sm
    SAM, Apr 7, 2008
    #2
    1. Advertising

  3. dave

    dave Guest

    On Apr 7, 3:19 pm, SAM <>
    wrote:
    > dave a écrit :
    >
    > > IE7 is generating an "object doesn't support this property or
    > > method.." when i do

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

    >
    > before end of loading or after ?
    >
    > --
    > sm


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

    dave Guest

    On Apr 7, 3:19 pm, SAM <>
    wrote:
    > dave a écrit :
    >
    > > IE7 is generating an "object doesn't support this property or
    > > method.." when i do

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

    >
    > before end of loading or after ?
    >
    > --
    > sm


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

    dave Guest

    On Apr 7, 3:27 pm, dave <> wrote:
    > On Apr 7, 3:19 pm, SAM <>
    > wrote:
    >
    > > dave a écrit :

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

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

    >
    > > before end of loading or after ?

    >
    > > --
    > > sm

    >
    > after... the alert works but not the assign


    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. dave wrote:
    > On Apr 7, 3:27 pm, dave <> wrote:
    >> On Apr 7, 3:19 pm, SAM <>
    >> wrote:
    >>> dave a écrit :
    >>>> IE7 is generating an "object doesn't support this property or
    >>>> method.." when i do
    >>>> foo = document.getElementById('bar').value;
    >>> before end of loading or after ?
    >>> [...]

    >> after... the alert works but not the assign

    >
    > After some testing, it became apparent that assigning it to "keywords"
    > was causing the error. I guess M$ made up some javascript reserved
    > words.


    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
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
    Thomas 'PointedEars' Lahn, Apr 8, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    826
  2. HANM
    Replies:
    2
    Views:
    698
    Joseph Kesselman
    Jan 29, 2008
  3. Thomas W.
    Replies:
    12
    Views:
    192
    Mike Moore
    Mar 4, 2011
  4. Susan Cranford
    Replies:
    2
    Views:
    392
  5. MuhammedRefaat

    How to assign input value in html?

    MuhammedRefaat, Sep 22, 2013, in forum: HTML and CSS
    Replies:
    0
    Views:
    534
    MuhammedRefaat
    Sep 22, 2013
Loading...

Share This Page