Re: Loading client-side images for use in Javascript

Discussion in 'ASP .Net' started by Vidar Petursson, Jul 18, 2003.

  1. Hi

    var imgDown = new Image();
    imgDown.src = "PATH/Image.gif";

    setNewImg(e){
    e.src = imgDown.src;
    }

    <img onclick="setNewImg(this)">

    --
    Best Regards
    Vidar Petursson
    ==============================
    Microsoft Internet Client & Controls MVP
    ==============================
    "John" <> wrote in message
    news:...
    > Hi all,
    >
    > I did post this a short while back and received a couple of answers but

    I'm
    > still stuck. What I've done is pasted the source below. This is what

    appears
    > in my html document when the source is viewed.
    >
    > <script>
    > var imgdown = new Image;
    > imgdown.src = 'C:\Inetpub\wwwroot\testapp\Images\down.gif';
    > </script>
    >
    > Later on, if a user clicks on an area, some Javascript runs and it

    attempts
    > to replace that same area with the 'pre-populated' imgdown image object

    but
    > nothing shows.
    >
    > The path to the image is correct. What am I doing wrong here?
    >
    > Regards
    > John.
    >
    >
     
    Vidar Petursson, Jul 18, 2003
    #1
    1. Advertising

  2. Vidar Petursson

    John Guest

    Hi Vidar,

    Please excuse the ignorance but what should I use in the 'PATH' part? The
    stringbuilder section where I write the javascript text is from within a
    user control which is in another folder off the web root.

    Regards
    John.


    "Vidar Petursson" <> wrote in message
    news:#wg$#...
    > Hi
    >
    > var imgDown = new Image();
    > imgDown.src = "PATH/Image.gif";
    >
    > setNewImg(e){
    > e.src = imgDown.src;
    > }
    >
    > <img onclick="setNewImg(this)">
    >
    > --
    > Best Regards
    > Vidar Petursson
    > ==============================
    > Microsoft Internet Client & Controls MVP
    > ==============================
    > "John" <> wrote in message
    > news:...
    > > Hi all,
    > >
    > > I did post this a short while back and received a couple of answers but

    > I'm
    > > still stuck. What I've done is pasted the source below. This is what

    > appears
    > > in my html document when the source is viewed.
    > >
    > > <script>
    > > var imgdown = new Image;
    > > imgdown.src = 'C:\Inetpub\wwwroot\testapp\Images\down.gif';
    > > </script>
    > >
    > > Later on, if a user clicks on an area, some Javascript runs and it

    > attempts
    > > to replace that same area with the 'pre-populated' imgdown image object

    > but
    > > nothing shows.
    > >
    > > The path to the image is correct. What am I doing wrong here?
    > >
    > > Regards
    > > John.
    > >
    > >

    >
    >
     
    John, Jul 18, 2003
    #2
    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. John
    Replies:
    2
    Views:
    392
    Vidar Petursson
    Jul 15, 2003
  2. j0vo
    Replies:
    2
    Views:
    398
  3. Boss302
    Replies:
    0
    Views:
    1,098
    Boss302
    Nov 21, 2006
  4. Bogdan
    Replies:
    2
    Views:
    686
    Bogdan
    Jun 9, 2008
  5. Zoe Hart
    Replies:
    1
    Views:
    401
    Scott Wisniewski
    Jan 8, 2004
Loading...

Share This Page