Preload Image in Docwrite

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

    Preload Image in Docwrite

    I'm looking for an example of using a single preloaded image, where a
    few images are loaded in a document.write.

    Can anyone help with a simple example (as I'm still a novice in
    javascript).

    TIA
    Bruce
  • Evertjan.

    #2
    Re: Preload Image in Docwrite

    Bruce wrote on 16 feb 2004 in comp.lang.javas cript:
    [color=blue]
    > I'm looking for an example of using a single preloaded image, where a
    > few images are loaded in a document.write.
    >
    > Can anyone help with a simple example (as I'm still a novice in
    > javascript).
    >[/color]

    You cannot load something "in" a document.write.

    What is the purpose of your quest?

    Perhaps you can refrase youe question?

    document.write is mostly only useful when the setup(!) of a page should be
    dynamic. Dynamic image preloading does not need document.write.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Bruce

      #3
      Re: Preload Image in Docwrite

      "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message news:<Xns94916A C42D2E1eejj99@1 94.109.133.29>. ..[color=blue]
      > You cannot load something "in" a document.write.
      > What is the purpose of your quest?
      > Perhaps you can refrase youe question?
      > document.write is mostly only useful when the setup(!) of a page should be
      > dynamic. Dynamic image preloading does not need document.write.[/color]

      I have a working page that uses a mapped image. When the user presses
      one of the mapped areas (call them buttons), in some instances another
      image (one of a few) is displayed (using a style sheet) and some text
      appears (also using a style sheet). The trouble that the text appears
      before the image, and that is why I need to preload those image(s), so
      both appear at the same time. I am using document.write( s) to display
      the second image (one of a few) and its accompanying text.

      Bruce

      Comment

      • Evertjan.

        #4
        Re: Preload Image in Docwrite

        Bruce wrote on 18 feb 2004 in comp.lang.javas cript:[color=blue]
        > I am using document.write( s) to display
        > the second image (one of a few) and its accompanying text.[/color]

        You cannot use document.write when the page is finished without destroying
        the finished page and its script.

        So better change the src or the innerHTML of a finished container:

        <button onclick="docume nt.getElementBy Id('ImgPos').sr c='/img/New.jpg'">
        change image</button>

        <img src='/img/Old.jpg' id="ImgPos">



        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress)

        Comment

        Working...