472,986 Members | 2,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,986 software developers and data experts.

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="javascript1.2"
src="file:///C:\row_functions.js" >
</script>
<SCRIPT language="javascript1.2"
src="file:///C:\data_check_functions.js" >
</script>
<SCRIPT language="javascript1.2" ><!--

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

----- CUT out the rest

Jul 23 '05 #1
6 6340
milkyway wrote:
Hello everyone,

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

<SCRIPT language="javascript1.2"
src="file:///C:\row_functions.js" >
</script>
<SCRIPT language="javascript1.2"
src="file:///C:\data_check_functions.js" >
</script>


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
Jul 23 '05 #2
On 16 Jan 2005 08:53:48 -0800 milkyway wrote:
Hello everyone, What is the correct way to incorporate a .js file into an HTML file
*IF* the .js file on a hard disk?

Same as you would for on a website.

<script src="filename.js" 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.
Jul 23 '05 #3
In article <11**********************@c13g2000cwb.googlegroups .com>,
"milkyway" <d0******@hotmail.com> wrote:
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="javascript1.2"
src="file:///C:\row_functions.js" >
</script>
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 //.
<SCRIPT language="javascript1.2"


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">
Jul 23 '05 #4
In article <ba*********************@twister.nyroc.rr.com>,
Mick White <mw***********@rochester.rr.com> wrote:

Why not place the external files in the same directory as the ppage?

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

Robert
Jul 23 '05 #5
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:
In article <ba*********************@twister.nyroc.rr.com>,
Mick White <mw***********@rochester.rr.com> wrote:

Why not place the external files in the same directory as the
ppage?

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

Robert


Jul 23 '05 #6
Robert wrote:
In article <11**********************@c13g2000cwb.googlegroups .com>,
"milkyway" <d0******@hotmail.com> wrote:

<--snip-->
<SCRIPT language="javascript1.2"

Do you know that javascript1.2 uses a different definition of equal (=)
inside an if statement?


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


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.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Lu | last post by:
Hi there, I got a program to write data to a randomly accessed file (the program moves file pointer to a certain position of the file according the current "keyword" and then writes data). It...
53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
1
by: David M. Gauntt | last post by:
I have been testing some javascript for my professional society web page, and found that I couldn't get Safari to save any cookies. No matter what I assign to document.cookie, I get an empty...
6
by: milkyway | last post by:
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...
1
by: Tim | last post by:
Hi, We are downloading a few thousand rows of data for users to choose from and need to speed up the operation. The data is related in four levels. The current design allows the user to select...
4
by: Carlitos | last post by:
I have researched a lot trying to get this. So as a last resource I will have to ask here. What would be the equivalent to the following javascript excerpt: TheDataManager MyDMgr = new...
6
by: Alan Wang | last post by:
Hi All, My application puts standard output from command line(using process.start()) into a file on the hard disk then reads the info from that file after command has finished. The problem is...
3
by: noridotjabi | last post by:
Say I'm writting a program. In this program for some reason I need to store data somewere were I will be able to access it again. I don't want to store it in a file because then it could be...
1
by: tsxn26 | last post by:
Does anyone know of a javascript that will popup a dialog box similiar to the "Save to" & "File upload" boxes but insteads let's you choose a path and will return the path to a text box? What I...
12
by: glennanthonyb | last post by:
Hi The company I work for has finally woken up to data security on our field laptops. I'm writing something in C# that will allow remote deletion of sensitive data and I don't believe...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.