Firefox and getElementById

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hartmut J?ger

    #1

    Firefox and getElementById

    Hi there,

    I defined a div in the HTML body like this one:

    <div id="santa" style="position : absolute; top: 400px; left: 700px;">
    <img src="grafiken/xmasani.gif" width="96" height="72" border="0">
    </div>

    When I refer in JavaScript to this <div> with:

    document.getEle mentById["santa"].style.pixelTop = docheight-72;

    I always get the error message "document.getEl ementById.santa has no
    properties" in Firefox 1.0 JavaScript Console.

    Where is the point of my mistake?

    I want to move a GIF-Animation on the document window. In IE6 all runs
    well.

    Thanks for help. Hartmut
  • Mick White

    #2
    Re: Firefox and getElementById

    Hartmut J?ger wrote:
    [color=blue]
    >
    > document.getEle mentById["santa"].style.pixelTop = docheight-72;[/color]

    document.getEle mentById("santa ").style.pixelT op = docheight-72;

    Mick

    Comment

    • Martin Honnen

      #3
      Re: Firefox and getElementById



      Hartmut J?ger wrote:

      [color=blue]
      > I defined a div in the HTML body like this one:
      >
      > <div id="santa" style="position : absolute; top: 400px; left: 700px;">
      > <img src="grafiken/xmasani.gif" width="96" height="72" border="0">
      > </div>
      >
      > When I refer in JavaScript to this <div> with:
      >
      > document.getEle mentById["santa"].style.pixelTop = docheight-72;[/color]

      That is a function you need to call with () e.g.
      document.getEle mentById("santa ")
      Also pixelTop is not a property defined in CSS so use
      document.getEle mentById("santa ").style.to p = (docheight-72) + 'px';




      --

      Martin Honnen
      http://JavaScript.FAQTs.com/

      Comment

      • RobG

        #4
        Re: Firefox and getElementById

        Hartmut J?ger wrote:
        [...][color=blue]
        > I want to move a GIF-Animation on the document window. In IE6 all runs
        > well.[/color]

        Because Microsoft seems to find it amusing to allow invalid markup and
        scripting to work on an /ad hoc/ basis.

        --
        Rob

        Comment

        • Hartmut J?ger

          #5
          Re: Firefox and getElementById

          RobG <rgqld@iinet.ne t.auau> wrote in message news:<41a917e8$ 0$25789$5a62ac2 2@per-qv1-newsreader-01.iinet.net.au >...[color=blue]
          > Hartmut Jaeger wrote:
          > [...][color=green]
          > > I want to move a GIF-Animation on the document window. In IE6 all runs
          > > well.[/color]
          >
          > Because Microsoft seems to find it amusing to allow invalid markup and
          > scripting to work on an /ad hoc/ basis.[/color]

          Thanks to all for your answers. It works fine now with Firefox. Seems,
          that I use the wrong books, because I can read in SelfHTML (a german
          online book) document.getEle mentById["...."] with [] paranthesis.

          And a peaceful christmas time to you all. Hartmut

          Comment

          • Martin Bialasinski

            #6
            Re: Firefox and getElementById

            hartmut.jaeger@ jaeger-edv-service.de (Hartmut J?ger) wrote:
            [color=blue]
            > Thanks to all for your answers. It works fine now with Firefox. Seems,
            > that I use the wrong books, because I can read in SelfHTML (a german
            > online book) document.getEle mentById["...."] with [] paranthesis.[/color]

            URL?


            is correct

            Comment

            • Michael Winter

              #7
              Re: Firefox and getElementById

              On Sun, 28 Nov 2004 14:51:39 +0100, Martin Bialasinski
              <agr30+news@u ni-koeln.de> wrote:

              [snip]
              [color=blue]
              > http://de.selfhtml.org/javascript/ob..._element_by_id
              > is correct[/color]

              Aside from the remarkably bad example, yes.

              Mike

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

              Comment

              Working...