javascript file (.js) on hard disk

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

    javascript file (.js) on hard disk

    Hello everyone,

    What is the correct way to incorporate a .js file into an HTML file
    *IF* the .js file on a hard disk?

    What I have tried is listed below but it does not work... When trying
    to access a function module in one of the .js files, I get an error
    that the function module is not defined (which would lead me to believe
    that it is not being imported with the .js "src" instruction.

    Does anyone know how to get around this?

    TIA.



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <META http-equiv=Content-Type content="text/html;
    charset=windows-1252">
    </HEAD>
    <SCRIPT language="javas cript1.2"
    src="file:///C:\row_function s.js" >
    </script>
    <SCRIPT language="javas cript1.2"
    src="file:///C:\data_check_f unctions.js" >
    </script>
    <SCRIPT language="javas cript1.2" ><!--

    ---- CUT out some executed functions -----
    --></SCRIPT>


    <BODY>

    ----- CUT out the rest

  • Mick White

    #2
    Re: javascript file (.js) on hard disk

    milkyway wrote:
    [color=blue]
    > Hello everyone,
    >
    > What is the correct way to incorporate a .js file into an HTML file
    > *IF* the .js file on a hard disk?[/color]
    [snip][color=blue]
    >
    >
    > <SCRIPT language="javas cript1.2"
    > src="file:///C:\row_function s.js" >
    > </script>
    > <SCRIPT language="javas cript1.2"
    > src="file:///C:\data_check_f unctions.js" >
    > </script>[/color]

    Those back slashes ("\") don't look correct to me, but I develop on Mac.
    Why not place the external files in the same directory as the ppage?
    I assume you are previewing locally.
    Mick

    Comment

    • Richard

      #3
      Re: javascript file (.js) on hard disk

      On 16 Jan 2005 08:53:48 -0800 milkyway wrote:
      [color=blue]
      > Hello everyone,[/color]
      [color=blue]
      > What is the correct way to incorporate a .js file into an HTML file
      > *IF* the .js file on a hard disk?[/color]


      Same as you would for on a website.

      <script src="filename.j s" type="text/javascript">

      list the "src" first.
      Your src file should be in the same directory as the calling file.
      if not, then use src="path/filename.js".
      BTW, DO NOT use the C:\ root directory for anything but the OS files.
      Always put your personal files into folders.


      Comment

      • Robert

        #4
        Re: javascript file (.js) on hard disk

        In article <1105894428.181 579.296990@c13g 2000cwb.googleg roups.com>,
        "milkyway" <d0mufasa@hotma il.com> wrote:
        [color=blue]
        > Hello everyone,
        >
        > What is the correct way to incorporate a .js file into an HTML file
        > *IF* the .js file on a hard disk?
        >
        > What I have tried is listed below but it does not work... When trying
        > to access a function module in one of the .js files, I get an error
        > that the function module is not defined (which would lead me to believe
        > that it is not being imported with the .js "src" instruction.
        >
        > Does anyone know how to get around this?
        >
        > TIA.
        >
        >
        >
        > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
        > <HTML>
        > <HEAD>
        > <META http-equiv=Content-Type content="text/html;
        > charset=windows-1252">
        > </HEAD>
        > <SCRIPT language="javas cript1.2"
        > src="file:///C:\row_function s.js" >
        > </script>[/color]

        Here is an example if both files are in the same folder.

        <script type="text/javascript"
        src="domwalker. js"></script>


        The backslash only works in IE. Use the forward slash instead. Also,
        the \ is a javascript escape character. You might try //.
        [color=blue]
        > <SCRIPT language="javas cript1.2"[/color]

        Do you know that javascript1.2 uses a different definition of equal (=)
        inside an if statement? If do not know the difference you want to use
        this line:
        <script type="text/javascript">

        Comment

        • Robert

          #5
          Re: javascript file (.js) on hard disk

          In article <baxGd.156600$A L5.120892@twist er.nyroc.rr.com >,
          Mick White <mwhite13BOGUS@ rochester.rr.co m> wrote:

          [color=blue]
          > Why not place the external files in the same directory as the ppage?[/color]


          An advantage of this is that you will not have to change your code when
          you move it to the server.

          Robert

          Comment

          • milkyway

            #6
            Re: javascript file (.js) on hard disk

            Hello again everyone,

            Thank you so much for your responses and advice :-)))

            I found out what the problem was. In the immortal words of Charlie
            Brown: AUUUGGGGGH!!!!!

            Basically, I created the files using the Windows interface. I saved
            them with the name of check_functions .js - well, it so happens that
            this *#$#%%@ thing saved it as check_functions .js.txt!!!

            When I went to the OS level and changed it to check_functions .js, all
            worked OK!!!

            Kindest Regards.


            Robert wrote:[color=blue]
            > In article <baxGd.156600$A L5.120892@twist er.nyroc.rr.com >,
            > Mick White <mwhite13BOGUS@ rochester.rr.co m> wrote:
            >
            >[color=green]
            > > Why not place the external files in the same directory as the[/color][/color]
            ppage?[color=blue]
            >
            >
            > An advantage of this is that you will not have to change your code[/color]
            when[color=blue]
            > you move it to the server.
            >
            > Robert[/color]

            Comment

            • Randy Webb

              #7
              Re: javascript file (.js) on hard disk

              Robert wrote:
              [color=blue]
              > In article <1105894428.181 579.296990@c13g 2000cwb.googleg roups.com>,
              > "milkyway" <d0mufasa@hotma il.com> wrote:
              >[/color]

              <--snip-->
              [color=blue][color=green]
              >><SCRIPT language="javas cript1.2"[/color]
              >
              >
              > Do you know that javascript1.2 uses a different definition of equal (=)
              > inside an if statement?[/color]

              Only in certain browsers.
              [color=blue]
              > If do not know the difference you want to use this line:
              > <script type="text/javascript">[/color]

              You should use the type attribute even if you *do* know the difference.
              Unless you are after one of the quirks that 1.2 invokes in Netscape 4

              --
              Randy
              comp.lang.javas cript FAQ - http://jibbering.com/faq

              Comment

              Working...