FireFox called an IMG object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • QA

    FireFox called an IMG object

    It works fine in IE and Opera, but in Firefox, I had to put the <img
    name=something src> within a <form></form>

    it seems to me in IE/Opera, i can do

    document.imagen ame.src
    in Firefox
    I have to do
    document.formna me.imagename.sr c

    Is that right? Anyway to get around this?


  • Michael Winter

    #2
    Re: FireFox called an IMG object

    On Fri, 10 Sep 2004 08:23:01 GMT, QA <QA@alexa.com > wrote:
    [color=blue]
    > It works fine in IE and Opera, but in Firefox, I had to put the <img
    > name=something src> within a <form></form>
    >
    > it seems to me in IE/Opera, i can do
    >
    > document.imagen ame.src
    > in Firefox
    > I have to do
    > document.formna me.imagename.sr c
    >
    > Is that right? Anyway to get around this?[/color]

    To be honest, I don't see how that would help. Very odd if it does. The
    better solution would be to use the images collection. Try:

    document.images['imagename'].src

    If imagename is a variable containing the name, remove the quotes.

    Good luck,
    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.

    Comment

    • QA

      #3
      Re: FireFox called an IMG object

      [color=blue][color=green]
      > > It works fine in IE and Opera, but in Firefox, I had to put the <img
      > > name=something src> within a <form></form>
      > >
      > > it seems to me in IE/Opera, i can do
      > >
      > > document.imagen ame.src
      > > in Firefox
      > > I have to do
      > > document.formna me.imagename.sr c
      > >
      > > Is that right? Anyway to get around this?[/color]
      >
      > To be honest, I don't see how that would help. Very odd if it does. The
      > better solution would be to use the images collection. Try:
      >
      > document.images['imagename'].src[/color]

      What about document.getEle mentById('image name')?
      I am not sure if getElementById is cross browser too. I am very confused
      about how the object works in different browers. Especially window and
      document. I feel they are the same thing, but sometimes they are different.
      windows.href, document.locati on, document.locati on.href, ....


      Comment

      • Michael Winter

        #4
        Re: FireFox called an IMG object

        On Sat, 11 Sep 2004 02:40:36 GMT, QA <QA@alexa.com > wrote:
        [color=blue][color=green][color=darkred]
        >>> It works fine in IE and Opera, but in Firefox, I had to put the <img
        >>> name=something src> within a <form></form>
        >>>
        >>> it seems to me in IE/Opera, i can do
        >>>
        >>> document.imagen ame.src
        >>> in Firefox
        >>> I have to do
        >>> document.formna me.imagename.sr c
        >>>
        >>> Is that right? Anyway to get around this?[/color]
        >>
        >> To be honest, I don't see how that would help. Very odd if it does. The
        >> better solution would be to use the images collection. Try:
        >>
        >> document.images['imagename'].src[/color]
        >
        > What about document.getEle mentById('image name')?[/color]

        It depends what you're trying to access. If you're attempting to retrieve
        a reference to an image, use the images collection as I've shown above.
        Not only is part of the current Document Object Model (DOM) standards, but
        it is supported by browsers at least as far back as NN4.

        document.getEle mentById should only be used to access elements with id
        attributes, and there are no other ways of referencing that data. This is
        because whilst a standard method supported on the vast majority of modern,
        scriptable browsers, it's not supported by all by older browsers.
        [color=blue]
        > I am not sure if getElementById is cross browser too. I am very confused
        > about how the object works in different browers. Especially window and
        > document. I feel they are the same thing, but sometimes they are
        > different.[/color]

        The window and document objects are entirely different.

        The window object (also the frame object) is the global object. Global
        variables, functions and host objects are properties of this object. The
        formal standards for this object also specify few of the properties
        commonly used; they have become de facto standards.

        The document object is the root object in the document tree. All elements
        (and other nodes) used in your pages are a child of this object.
        [color=blue]
        > windows.href, document.locati on, document.locati on.href, ....[/color]

        I don't believe any of those are correct. You're thinking of location.href
        (or window.location .href, but it's exactly the same thing). The location
        object is one of those de facto objects, but it is well supported.

        Mike

        --
        Michael Winter
        Replace ".invalid" with ".uk" to reply by e-mail.

        Comment

        Working...