Multiple JavaScript includes fail

M

McKirahan

Has anyone experienced this (and found a solution)?

I have five files: a .htm that invokes four .js include files.

Only the first alert in the first include is displayed.

This only happens when I run on a client's corporate server.

I have no problems on a laptop connected to the network
or on my home PC. Any ideas? Thanks in advance.


<html>
<head>
<title>test_js.htm</title>
</head>
<body>
<script type="text/javascript" src="test_js.js"></script>
<script type="text/javascript" src="test_js.js1"></script>
<script type="text/javascript" src="test_js.js2"></script>
<script type="text/javascript" src="test_js.js3"></script>
</body>
</html>

alert("test_js.js");

alert("test_js.js1");

alert("test_js.js2");

window.onload = function() {
alert("test_js.js3");
}

I moved the includes into the head;
I took out the last include;
it still fails on one server.

I'm stumped.

If I merge them into one include it works.
 
M

McKirahan

Jim Land said:
Easy to try:
Create four html files on the server, each with only one js include.

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

<body>
<script type="text/javascript" src="test_js.js1"></script>
</body>

<body>
<script type="text/javascript" src="test_js.js2"></script>
</body>

<body>
<script type="text/javascript" src="test_js.js3"></script>
</body>

Try each html file. Do they all work?

P.S. You can name your files any way you like, but wouldn't test_js1.js
be more logical than test_js.js1?

Thanks for your reply but you didn't understand.

The example I included fails only on one server.

Each of the includes work -- all they do is show an alert.
 
M

McKirahan

Jim Land said:
Explain a little more, then. How many servers are there? Where do the JS
files reside, on only one server, or on all of the servers?

Thanks again for your interest.

I thought there was enough information in my first post...

The example I posted fails but only on one server.

Of course my example is a stripped down subset of a real
problem -- but it doesn't matter as the example fails!

Create the files, put them in a folder on a Web server,
then open the page via http://whatever/test_js.htm

P.S. I used "test_js" as the filename prefix as I have other
"test_" prefixed files in the same folder.
 
K

Kevin Scholl

McKirahan said:
Has anyone experienced this (and found a solution)?

I have five files: a .htm that invokes four .js include files.

Only the first alert in the first include is displayed.

This only happens when I run on a client's corporate server.

I have no problems on a laptop connected to the network
or on my home PC. Any ideas? Thanks in advance.


<html>
<head>
<title>test_js.htm</title>
</head>
<body>
<script type="text/javascript" src="test_js.js"></script>
<script type="text/javascript" src="test_js.js1"></script>
<script type="text/javascript" src="test_js.js2"></script>
<script type="text/javascript" src="test_js.js3"></script>

The server probably doesn't understand what .js1, .js2, and .js3 files
are. And rightly so, since those are non-standard file extensions.
Rename your files

test_js.js
test_js1.js
test_js2.js
test_js3.js

and correct the associated calls to them, and all should be fine.

HTH.

--

*** Remove the DELETE from my address to reply ***

======================================================
Kevin Scholl http://www.ksscholl.com/
(e-mail address removed)
 
M

McKirahan

[snip]
The server probably doesn't understand what .js1, .js2, and .js3 files
are. And rightly so, since those are non-standard file extensions.
Rename your files

test_js.js
test_js1.js
test_js2.js
test_js3.js

and correct the associated calls to them, and all should be fine.

I'm sure that's it -- I'll test it tomorrow.

Their server is IIS 6.0 while the others are IIS 5.1 and PWS.

Apparently it's a configuration issue.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top