Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • §Þ¦w

    Help

    How can i get the present filename (the opened html) and print it in the
    html (this html)?
    thx


  • Lasse Reichstein Nielsen

    #2
    Re: Help

    "§Þ¦w" <§Þ¦w@§Þ¦w¡E¤½¥ q> writes:
    [color=blue]
    > How can i get the present filename (the opened html) and print it in the
    > html (this html)?[/color]

    <script type="text/javascript">
    write(location. pathname);
    </script>

    This includes the path. You'll have to cut it away if you don't want it.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • HikksNotAtHome

      #3
      Re: Help

      In article <ad9vhsy5.fsf@h otpop.com>, Lasse Reichstein Nielsen <lrn@hotpop.com >
      writes:
      [color=blue]
      ><script type="text/javascript">
      > write(location. pathname);
      ></script>[/color]

      object expected :)

      document.write( location.pathna me);
      perhaps?
      --
      Randy

      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: Help

        hikksnotathome@ aol.com (HikksNotAtHome ) writes:
        [color=blue]
        > object expected :)
        >
        > document.write( location.pathna me);
        > perhaps?[/color]

        Doh. Yes. Not window.write.

        /L
        --
        Lasse Reichstein Nielsen - lrn@hotpop.com
        Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
        'Faith without judgement merely degrades the spirit divine.'

        Comment

        • Grant Wagner

          #5
          Re: Help

          "§Þ¦w" wrote:
          [color=blue]
          > How can i get the present filename (the opened html) and print it in the
          > html (this html)?
          > thx[/color]

          var protocol = window.location .protocol;
          var path = window.location .pathname;
          // this is required because IE loading files locally uses "\" and not "/"
          var separator = (protocol == "file:" && path.indexOf("/", 1) == -1 ? "\\" :
          "/");
          var path = window.location .pathname;
          var file = path.substring( path.lastIndexO f(separator) + 1);
          document.write( file);



          --
          | Grant Wagner <gwagner@agrico reunited.com>

          * Client-side Javascript and Netscape 4 DOM Reference available at:
          *


          * Internet Explorer DOM Reference available at:
          *
          Gain technical skills through documentation and training, earn certifications and connect with the community


          * Netscape 6/7 DOM Reference available at:
          * http://www.mozilla.org/docs/dom/domref/
          * Tips for upgrading JavaScript for Netscape 7 / Mozilla
          * http://www.mozilla.org/docs/web-deve...upgrade_2.html


          Comment

          • ??

            #6
            Re: Help

            what is the difference between this two method?
            sorry, i m new user, maybe ask a stupid question...
            thx

            "Grant Wagner" <gwagner@agrico reunited.com> ???
            news:3F4E05CA.7 F80C5AA@agricor eunited.com ???...[color=blue]
            > "§Þ¦w" wrote:
            >[color=green]
            > > How can i get the present filename (the opened html) and print it in the
            > > html (this html)?
            > > thx[/color]
            >
            > var protocol = window.location .protocol;
            > var path = window.location .pathname;
            > // this is required because IE loading files locally uses "\" and not "/"
            > var separator = (protocol == "file:" && path.indexOf("/", 1) == -1 ? "\\"[/color]
            :[color=blue]
            > "/");
            > var path = window.location .pathname;
            > var file = path.substring( path.lastIndexO f(separator) + 1);
            > document.write( file);
            >
            >
            >
            > --
            > | Grant Wagner <gwagner@agrico reunited.com>
            >
            > * Client-side Javascript and Netscape 4 DOM Reference available at:
            > *
            >[/color]
            http://devedge.netscape.com/library/...ce/frames.html[color=blue]
            >
            > * Internet Explorer DOM Reference available at:
            > *
            >[/color]
            http://msdn.microsoft.com/workshop/a...ence_entry.asp[color=blue]
            >
            > * Netscape 6/7 DOM Reference available at:
            > * http://www.mozilla.org/docs/dom/domref/
            > * Tips for upgrading JavaScript for Netscape 7 / Mozilla
            > * http://www.mozilla.org/docs/web-deve...upgrade_2.html
            >
            >[/color]


            Comment

            • Grant Wagner

              #7
              Re: Help

              Between what two method? The code I provided in a single solution that provides the
              functionality you originally required (to output the filename of the current file loaded
              into the browser).

              ?? wrote:
              [color=blue]
              > what is the difference between this two method?
              > sorry, i m new user, maybe ask a stupid question...
              > thx
              >
              > "Grant Wagner" <gwagner@agrico reunited.com> ???
              > news:3F4E05CA.7 F80C5AA@agricor eunited.com ???...[color=green]
              > > "§Þ¦w" wrote:
              > >[color=darkred]
              > > > How can i get the present filename (the opened html) and print it in the
              > > > html (this html)?
              > > > thx[/color]
              > >
              > > var protocol = window.location .protocol;
              > > var path = window.location .pathname;
              > > // this is required because IE loading files locally uses "\" and not "/"
              > > var separator = (protocol == "file:" && path.indexOf("/", 1) == -1 ? "\\"[/color]
              > :[color=green]
              > > "/");
              > > var path = window.location .pathname;
              > > var file = path.substring( path.lastIndexO f(separator) + 1);
              > > document.write( file);[/color][/color]

              --
              | Grant Wagner <gwagner@agrico reunited.com>

              * Client-side Javascript and Netscape 4 DOM Reference available at:
              * http://devedge.netscape.com/library/...ce/frames.html
              * Internet Explorer DOM Reference available at:
              * http://msdn.microsoft.com/workshop/a...ence_entry.asp
              * Netscape 6/7 DOM Reference available at:
              * http://www.mozilla.org/docs/dom/domref/
              * Tips for upgrading JavaScript for Netscape 7 / Mozilla
              * http://www.mozilla.org/docs/web-deve...upgrade_2.html


              Comment

              Working...