Re: Loading client-side images for use in Javascript

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

  1. j0vo

    j0vo Guest

    Ok, I'll play the dumb guy.... if your script is running on the server under
    the testapp application, why isn't the source 'Images/down.gif' (Path
    relative) to the application and the full path on the server? At least if
    nothing else, this would make the code more transportable to serveral hosts
    without having to rely on the fact that inetpub/wwwroot is the actual root
    of the web server (which it is not on my machines).

    Cheers

    "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.
    >
    >
     
    j0vo, Jul 18, 2003
    #1
    1. Advertising

  2. j0vo

    John Guest

    Hi,

    I did actually try "..\Images\down.gif" and "Images/down.gif" and both don't
    work for me. WHat now?

    Regards
    John.

    "j0vo" <> wrote in message
    news:...
    > Ok, I'll play the dumb guy.... if your script is running on the server

    under
    > the testapp application, why isn't the source 'Images/down.gif' (Path
    > relative) to the application and the full path on the server? At least if
    > nothing else, this would make the code more transportable to serveral

    hosts
    > without having to rely on the fact that inetpub/wwwroot is the actual root
    > of the web server (which it is not on my machines).
    >
    > Cheers
    >
    > "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

  3. j0vo

    j0vo Guest

    I did not see your prior posts, but if the script is on the executing on
    the web server in the context of the app, then things should be cool with
    path absolute or relative. But your subject line indicates that perhaps the
    script is a client-side script running in the browser. If it is a script
    running in the browser, then I would not ever expect path relative or
    absolute addressing from the client script to ever be able to directly
    access a file on the web server like you have it.

    Instead, I would imagine the .NET aspx to script something like

    string newPath = Request.Application.Path + "/images/down.gif";

    where the above body is specified in a runat=server block of code -- so that
    the application path can be rewritten by the web server so that the client
    browser can load it via URL.


    That is my guess, not knowing anything about your application -- Hope it
    helps, good luck


    "John" <> wrote in message
    news:...
    > Hi,
    >
    > I did actually try "..\Images\down.gif" and "Images/down.gif" and both

    don't
    > work for me. WHat now?
    >
    > Regards
    > John.
    >
    > "j0vo" <> wrote in message
    > news:...
    > > Ok, I'll play the dumb guy.... if your script is running on the server

    > under
    > > the testapp application, why isn't the source 'Images/down.gif' (Path
    > > relative) to the application and the full path on the server? At least

    if
    > > nothing else, this would make the code more transportable to serveral

    > hosts
    > > without having to rely on the fact that inetpub/wwwroot is the actual

    root
    > > of the web server (which it is not on my machines).
    > >
    > > Cheers
    > >
    > > "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.
    > > >
    > > >

    > >
    > >

    >
    >
     
    j0vo, Jul 19, 2003
    #3
    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:
    382
    Vidar Petursson
    Jul 15, 2003
  2. Vidar Petursson
    Replies:
    1
    Views:
    332
  3. Boss302
    Replies:
    0
    Views:
    1,056
    Boss302
    Nov 21, 2006
  4. Bogdan
    Replies:
    2
    Views:
    655
    Bogdan
    Jun 9, 2008
  5. Zoe Hart
    Replies:
    1
    Views:
    373
    Scott Wisniewski
    Jan 8, 2004
Loading...

Share This Page