img processing with .js and .css

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

    img processing with .js and .css

    Here is an img specification

    <IMG SRC="https://my/current/location/file.gif" name="Pt2" width="15">

    I would like to use a .css specification, to allow me to stop
    hard-coding that location in all my files. I can't seem to find the
    correct .css incantation for this.

    Suggestions?
  • Evertjan.

    #2
    Re: img processing with .js and .css

    Paul Thompson wrote on 01 feb 2005 in comp.lang.javas cript:
    [color=blue]
    > Here is an img specification
    >
    > <IMG SRC="https://my/current/location/file.gif" name="Pt2" width="15">
    >
    > I would like to use a .css specification, to allow me to stop
    > hard-coding that location in all my files. I can't seem to find the
    > correct .css incantation for this.
    >
    > Suggestions?
    >[/color]

    That is not where css is for. Though you could declare a background image
    in a div, it is not that usefull methinks.

    Furthermore this is a javascript NG and not a CSS one.

    With javascript the answer is easy.

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)

    Comment

    • Paul Thompson

      #3
      Re: img processing with .js and .css

      Evertjan. wrote:
      [color=blue]
      > Paul Thompson wrote on 01 feb 2005 in comp.lang.javas cript:
      >
      >[color=green]
      >>Here is an img specification
      >>
      >><IMG SRC="https://my/current/location/file.gif" name="Pt2" width="15">
      >>
      >>I would like to use a .css specification, to allow me to stop
      >>hard-coding that location in all my files. I can't seem to find the
      >>correct .css incantation for this.
      >>
      >>Suggestions ?
      >>[/color]
      >
      >
      > That is not where css is for. Though you could declare a background image
      > in a div, it is not that usefull methinks.
      >
      > Furthermore this is a javascript NG and not a CSS one.
      >
      > With javascript the answer is easy.
      >[/color]
      Would you mind giving it out, or directing me to the correct place?

      Comment

      • Evertjan.

        #4
        Re: img processing with .js and .css

        Paul Thompson wrote on 01 feb 2005 in comp.lang.javas cript:
        [color=blue][color=green]
        >> Furthermore this is a javascript NG and not a CSS one.
        >>
        >> With javascript the answer is easy.
        >>[/color]
        > Would you mind giving it out, or directing me to the correct place?
        >[/color]

        Try for CSS:

        <news:comp.info systems.www.aut horing.styleshe ets>

        --
        Evertjan.
        The Netherlands.
        (Replace all crosses with dots in my emailaddress)

        Comment

        • Robert

          #5
          Re: img processing with .js and .css

          In article <ctoaiv$he1$2@n ewsreader.wustl .edu>,
          Paul Thompson <paul@wubios.wu stl.edu> wrote:
          [color=blue]
          > Here is an img specification
          >
          > <IMG SRC="https://my/current/location/file.gif" name="Pt2" width="15">
          >
          > I would like to use a .css specification, to allow me to stop
          > hard-coding that location in all my files. I can't seem to find the
          > correct .css incantation for this.
          >
          > Suggestions?[/color]

          Do you know about relative addressing?

          <IMG SRC="file.gif" name="Pt2" width="15">

          Will read the file file.gif from your currect directory or when on a web
          server from the directory the html page was loaded from.

          <IMG SRC="sub/file.gif" name="Pt2" width="15"> Will read the file.gif
          from the directory sub in you current directory and likewise from the
          directory sub in the directory the html file was loaded from.

          This is called a relative path. Directory is another name for folder.

          a more advanced technique...
          There is also the base tag that changes the 'path' of a page.

          Robert

          Comment

          • Paul Thompson

            #6
            Re: img processing with .js and .css

            Evertjan. wrote:
            [color=blue]
            > Paul Thompson wrote on 01 feb 2005 in comp.lang.javas cript:
            >
            >[color=green][color=darkred]
            >>>Furthermor e this is a javascript NG and not a CSS one.
            >>>
            >>>With javascript the answer is easy.
            >>>[/color]
            >>
            >>Would you mind giving it out, or directing me to the correct place?
            >>[/color]
            >
            >
            > Try for CSS:
            >
            > <news:comp.info systems.www.aut horing.styleshe ets>
            >[/color]

            I'd suggest that you use your very valuable time doing important things
            like blowing your nose or combing your hair.

            Thanks for your help. It is very useful.

            Comment

            • Paul Thompson

              #7
              Re: img processing with .js and .css

              Robert wrote:
              [color=blue]
              > In article <ctoaiv$he1$2@n ewsreader.wustl .edu>,
              > Paul Thompson <paul@wubios.wu stl.edu> wrote:
              >
              >[color=green]
              >>Here is an img specification
              >>
              >><IMG SRC="https://my/current/location/file.gif" name="Pt2" width="15">
              >>
              >>I would like to use a .css specification, to allow me to stop
              >>hard-coding that location in all my files. I can't seem to find the
              >>correct .css incantation for this.
              >>
              >>Suggestions ?[/color]
              >
              >
              > Do you know about relative addressing?
              >
              > <IMG SRC="file.gif" name="Pt2" width="15">[/color]

              I prefer to be more specific - when I use relative addressing, I am
              never sure about the root of the page.[color=blue]
              >
              > Will read the file file.gif from your currect directory or when on a web
              > server from the directory the html page was loaded from.
              >
              > <IMG SRC="sub/file.gif" name="Pt2" width="15"> Will read the file.gif
              > from the directory sub in you current directory and likewise from the
              > directory sub in the directory the html file was loaded from.
              >
              > This is called a relative path. Directory is another name for folder.
              >
              > a more advanced technique...
              > There is also the base tag that changes the 'path' of a page.
              >
              > Robert[/color]

              the setting of a document-level base path would be very helpful. Can
              you direct me more specifically? Thanks.

              Comment

              • Grant Wagner

                #8
                Re: img processing with .js and .css

                "Paul Thompson" <paul@wubios.wu stl.edu> wrote in message
                news:ctoaiv$he1 $2@newsreader.w ustl.edu...[color=blue]
                > Here is an img specification
                >
                > <IMG SRC="https://my/current/location/file.gif" name="Pt2" width="15">
                >
                > I would like to use a .css specification, to allow me to stop
                > hard-coding that location in all my files. I can't seem to find the
                > correct .css incantation for this.
                >
                > Suggestions?[/color]

                <base href="https://my/current/location">
                <img src="file.gif">

                Works in IE, FF 1.0 Opera 6.05 & 7.54u1 and Netscape 4.78, you will have
                to test other browsers you wish to support.

                Of course, by including a <base href="..."> you will now have to provide
                the appropriate relative (to that base href) references to any links and
                other resources that are on that page.

                --
                Grant Wagner <gwagner@agrico reunited.com>
                comp.lang.javas cript FAQ - http://jibbering.com/faq


                Comment

                • Paul Thompson

                  #9
                  Re: img processing with .js and .css

                  Grant Wagner wrote:[color=blue]
                  > "Paul Thompson" <paul@wubios.wu stl.edu> wrote in message
                  > news:ctoaiv$he1 $2@newsreader.w ustl.edu...
                  >[color=green]
                  >>Here is an img specification
                  >>
                  >><IMG SRC="https://my/current/location/file.gif" name="Pt2" width="15">
                  >>
                  >>I would like to use a .css specification, to allow me to stop
                  >>hard-coding that location in all my files. I can't seem to find the
                  >>correct .css incantation for this.
                  >>
                  >>Suggestions ?[/color]
                  >
                  >[/color]

                  thanks so much - exactly what i need
                  [color=blue]
                  > <base href="https://my/current/location">
                  > <img src="file.gif">
                  >
                  > Works in IE, FF 1.0 Opera 6.05 & 7.54u1 and Netscape 4.78, you will have
                  > to test other browsers you wish to support.
                  >
                  > Of course, by including a <base href="..."> you will now have to provide
                  > the appropriate relative (to that base href) references to any links and
                  > other resources that are on that page.
                  >[/color]

                  Comment

                  • Robert

                    #10
                    Re: img processing with .js and .css

                    >I prefer to be more specific - when I use[color=blue]
                    > relative addressing, I am
                    >never sure about the root of the page.[/color]

                    What is there to be unsure about. It is the directory/folder from
                    which the page is loaded.

                    This lets you move your web pages around your machine and to a server
                    without having to change the page.

                    This is what all the folks on the web do. Why don't you feel
                    comfortable with it?

                    Robert

                    Comment

                    • Grant Wagner

                      #11
                      Re: img processing with .js and .css

                      "Paul Thompson" <paul@wubios.wu stl.edu> wrote in message
                      news:ctorqd$n7t $1@newsreader.w ustl.edu...[color=blue]
                      > thanks so much - exactly what i need
                      >[color=green]
                      >> <base href="https://my/current/location">
                      >> <img src="file.gif">
                      >>
                      >> Works in IE, FF 1.0 Opera 6.05 & 7.54u1 and Netscape 4.78, you will
                      >> have to test other browsers you wish to support.
                      >>
                      >> Of course, by including a <base href="..."> you will now have to
                      >> provide the appropriate relative (to that base href) references to
                      >> any links and other resources that are on that page.[/color][/color]

                      Given all the posts related to this subject, it seems to me that I
                      should share that <base href...> is unnecessary if you are setting it to
                      the path the current page has been loaded from.

                      If you visit http://server/path/to/some/page.html and do not set <base
                      href...>, then all resources on that page to the same server are
                      relative to {document_root}/path/to/some where {document_root} is some
                      platform specific path which is irrelevant when it comes to moving
                      content around - for example, it may be C:\Documents and Settings\Me\My
                      Documents\My Webs on Windows, but /var/opt/apache/docs on *nix.

                      And using <base href...> (especially when it is unnecessary) can lead to
                      problems (HTML 4.0 Sourcebook, Page 214):

                      Be aware that browsers differ in their interpretation of BASE when it
                      comes to "bookmarkin g" a document or to accessing FORM or
                      ISINDEX-referenced resources: Some browsers use the BASE URL in these
                      cases, while others use the actual URL needed to retrieve the displayed
                      document.

                      Lastly, using absolutely referenced resource URLs is not a good
                      practice, because most modern Web browsers will use an existing
                      connection to the server to retrieve relatively-referenced resources.
                      Once you begin using an absolutely-referenced resource URL, the browser
                      must open a new connection to the server to retrieve the content. This
                      both slows down page load, and creates an unnecessary load on your
                      server.

                      Example:

                      http://server/path/to/some/page.html is loaded into your browser, it
                      contains: <img src="images/myimage.gif">. This resource may attempt to
                      (will definitely?) use the same connection the browser already has to
                      the server to retrieve myimage.gif. If instead you write: <img
                      src="http://server/path/to/some/images/myimage.gif">, the browser will
                      almost certainly open a new connection to the server to retrieve the
                      image.

                      --
                      Grant Wagner <gwagner@agrico reunited.com>
                      comp.lang.javas cript FAQ - http://jibbering.com/faq


                      Comment

                      Working...