473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

ASP.NEt with JS Files

Hey,

I'v had this problem for a while and I don't know why its not working.

If i place script in the ASP Page (HTML Section) then it works fine,
thou if i try to refrence a JS file, it wont work.

I have tried using <Script src="JavaScriptFile"
Type="text/Javascript"></scriptin the head, but I had no joy, thou if
I include the JavaScript in <scriptbrackets, it works fine, I have
also tried it with alert and the same happens, no matter what I try and
do, the java will only work when its in the page, otherwise I get the
error Object Expected.

The test code I have been trying is:

<html>
<head>
<Script src="bin/Test.js" type="text/javascript"></script>
</head>
<body onLoad="testFunction();">
</body>
</html>

and test function is:

function testFunction()
{
alert('test');
}

thanks for any help.

I am developing with ASP.NET V1.1

Jul 20 '06 #1
11 1101
"Dessip" wrote ...
<Script src="bin/Test.js" type="text/javascript"></script>
Unless you've changed the permissions, I'm not entirely sure you'll find
that the IUSR_Machine name account has permissions to access the /bin
directory.

..Net uses a separate processor account hence being able to access it. Try
moving the script file out to the root directory of your website, and then
change your src= attribute to match.

Regards

Rob
Jul 20 '06 #2
have you tried putting it in directory besides 'bin'? I always put my
js in a 'js' directory, I'd also try adjusting the path to be the
complete path from the root directory. ie:
/appfolder/js/javascriptfile.js


Dessip wrote:
Hey,

I'v had this problem for a while and I don't know why its not working.

If i place script in the ASP Page (HTML Section) then it works fine,
thou if i try to refrence a JS file, it wont work.

I have tried using <Script src="JavaScriptFile"
Type="text/Javascript"></scriptin the head, but I had no joy, thou if
I include the JavaScript in <scriptbrackets, it works fine, I have
also tried it with alert and the same happens, no matter what I try and
do, the java will only work when its in the page, otherwise I get the
error Object Expected.

The test code I have been trying is:

<html>
<head>
<Script src="bin/Test.js" type="text/javascript"></script>
</head>
<body onLoad="testFunction();">
</body>
</html>

and test function is:

function testFunction()
{
alert('test');
}

thanks for any help.

I am developing with ASP.NET V1.1
Jul 20 '06 #3
Is the file in "bin" folder or in the root one?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Dessip" <De****@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hey,

I'v had this problem for a while and I don't know why its not working.

If i place script in the ASP Page (HTML Section) then it works fine,
thou if i try to refrence a JS file, it wont work.

I have tried using <Script src="JavaScriptFile"
Type="text/Javascript"></scriptin the head, but I had no joy, thou if
I include the JavaScript in <scriptbrackets, it works fine, I have
also tried it with alert and the same happens, no matter what I try and
do, the java will only work when its in the page, otherwise I get the
error Object Expected.

The test code I have been trying is:

<html>
<head>
<Script src="bin/Test.js" type="text/javascript"></script>
</head>
<body onLoad="testFunction();">
</body>
</html>

and test function is:

function testFunction()
{
alert('test');
}

thanks for any help.

I am developing with ASP.NET V1.1

Jul 20 '06 #4
Hey,

Yeh i have tried that, cause i thought of permissions, but still
nothing, i ahve tryed it in 3 different lcoations, the root, Bin, and
also a folder called JS but still nothing.

im servearly at a loss here.

Short of includeing ethe javascript in all of the HTML pages, and
having to mod every one of them, and bulk them out with javaScript i
aint got a clue.

Regards
Chris

Eliyahu Goldin wrote:
Is the file in "bin" folder or in the root one?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Dessip" <De****@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hey,

I'v had this problem for a while and I don't know why its not working.

If i place script in the ASP Page (HTML Section) then it works fine,
thou if i try to refrence a JS file, it wont work.

I have tried using <Script src="JavaScriptFile"
Type="text/Javascript"></scriptin the head, but I had no joy, thou if
I include the JavaScript in <scriptbrackets, it works fine, I have
also tried it with alert and the same happens, no matter what I try and
do, the java will only work when its in the page, otherwise I get the
error Object Expected.

The test code I have been trying is:

<html>
<head>
<Script src="bin/Test.js" type="text/javascript"></script>
</head>
<body onLoad="testFunction();">
</body>
</html>

and test function is:

function testFunction()
{
alert('test');
}

thanks for any help.

I am developing with ASP.NET V1.1
Jul 20 '06 #5
"Dessip" wrote ...
Yeh i have tried that, cause i thought of permissions, but still
nothing, i ahve tryed it in 3 different lcoations, the root, Bin, and
also a folder called JS but still nothing.
hmmm..odd...

Isn't there a "language" attribute for that script tag too?

ie,

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

not sure if that might make any difference?

There's definately no problems in the test.js file is there? Maybe
something in there that would prevent it from loading/erroring or something?

Rob
Jul 20 '06 #6
The language isn't required, only type

Rob Meade wrote:
"Dessip" wrote ...
>Yeh i have tried that, cause i thought of permissions, but still
nothing, i ahve tryed it in 3 different lcoations, the root, Bin, and
also a folder called JS but still nothing.

hmmm..odd...

Isn't there a "language" attribute for that script tag too?

ie,

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

not sure if that might make any difference?

There's definately no problems in the test.js file is there? Maybe
something in there that would prevent it from loading/erroring or something?

Rob

Jul 20 '06 #7
"Ray Booysen" wrote ...
The language isn't required, only type
Yeah, just read up on it - depreciated...

Oh well - worth a shot...

Rob
Jul 20 '06 #8
I have tried it with and without language, no diff.

As for the JS file, i ahve also tried it with jsut that one function on
there, and still nothing.

I dont knwo why its not loading the JS file in, but no matter where i
put it, ill always get a error to do with the JS File (Object Expected)
Ray Booysen wrote:
The language isn't required, only type

Rob Meade wrote:
"Dessip" wrote ...
Yeh i have tried that, cause i thought of permissions, but still
nothing, i ahve tryed it in 3 different lcoations, the root, Bin, and
also a folder called JS but still nothing.
hmmm..odd...

Isn't there a "language" attribute for that script tag too?

ie,

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

not sure if that might make any difference?

There's definately no problems in the test.js file is there? Maybe
something in there that would prevent it from loading/erroring or something?

Rob
Jul 20 '06 #9
Im gong to try re-creating the project.
if not re-install the IIS, if not i aint got a clue.

Dessip wrote:
I have tried it with and without language, no diff.

As for the JS file, i ahve also tried it with jsut that one function on
there, and still nothing.

I dont knwo why its not loading the JS file in, but no matter where i
put it, ill always get a error to do with the JS File (Object Expected)
Ray Booysen wrote:
The language isn't required, only type

Rob Meade wrote:
"Dessip" wrote ...
>
>Yeh i have tried that, cause i thought of permissions, but still
>nothing, i ahve tryed it in 3 different lcoations, the root, Bin, and
>also a folder called JS but still nothing.
>
hmmm..odd...
>
Isn't there a "language" attribute for that script tag too?
>
ie,
>
<script src="test.js" type="text/javascript" language="javascript">
>
not sure if that might make any difference?
>
There's definately no problems in the test.js file is there? Maybe
something in there that would prevent it from loading/erroring or something?
>
Rob
>
>
Jul 20 '06 #10
Ok, just make a clean experiment. Leave the .js file in the same directory
with the .aspx file and delete it from all other locations. Refer to it as
<Script src="Test.js" type="text/javascript"></script>

Make sure there are no caching issues involved. For this, add an extra space
to both .aspx and .js files and save them to ensure the latest file
modification timestamp.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Dessip" <De****@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
Hey,

Yeh i have tried that, cause i thought of permissions, but still
nothing, i ahve tryed it in 3 different lcoations, the root, Bin, and
also a folder called JS but still nothing.

im servearly at a loss here.

Short of includeing ethe javascript in all of the HTML pages, and
having to mod every one of them, and bulk them out with javaScript i
aint got a clue.

Regards
Chris

Eliyahu Goldin wrote:
>Is the file in "bin" folder or in the root one?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Dessip" <De****@gmail.comwrote in message
news:11**********************@m79g2000cwm.googleg roups.com...
Hey,

I'v had this problem for a while and I don't know why its not working.

If i place script in the ASP Page (HTML Section) then it works fine,
thou if i try to refrence a JS file, it wont work.

I have tried using <Script src="JavaScriptFile"
Type="text/Javascript"></scriptin the head, but I had no joy, thou if
I include the JavaScript in <scriptbrackets, it works fine, I have
also tried it with alert and the same happens, no matter what I try and
do, the java will only work when its in the page, otherwise I get the
error Object Expected.

The test code I have been trying is:

<html>
<head>
<Script src="bin/Test.js" type="text/javascript"></script>
</head>
<body onLoad="testFunction();">
</body>
</html>

and test function is:

function testFunction()
{
alert('test');
}

thanks for any help.

I am developing with ASP.NET V1.1

Jul 20 '06 #11
Hello,

I have re-created the Virtual Directory like i said then I changed the
name of the JS file, and included it in the same directory like you
surgested,
And then it ran fine.

Thank you for your help.
Regards
Chris

Eliyahu Goldin wrote:
Ok, just make a clean experiment. Leave the .js file in the same directory
with the .aspx file and delete it from all other locations. Refer to it as
<Script src="Test.js" type="text/javascript"></script>

Make sure there are no caching issues involved. For this, add an extra space
to both .aspx and .js files and save them to ensure the latest file
modification timestamp.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Dessip" <De****@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
Hey,

Yeh i have tried that, cause i thought of permissions, but still
nothing, i ahve tryed it in 3 different lcoations, the root, Bin, and
also a folder called JS but still nothing.

im servearly at a loss here.

Short of includeing ethe javascript in all of the HTML pages, and
having to mod every one of them, and bulk them out with javaScript i
aint got a clue.

Regards
Chris

Eliyahu Goldin wrote:
Is the file in "bin" folder or in the root one?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Dessip" <De****@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hey,

I'v had this problem for a while and I don't know why its not working.

If i place script in the ASP Page (HTML Section) then it works fine,
thou if i try to refrence a JS file, it wont work.

I have tried using <Script src="JavaScriptFile"
Type="text/Javascript"></scriptin the head, but I had no joy, thou if
I include the JavaScript in <scriptbrackets, it works fine, I have
also tried it with alert and the same happens, no matter what I try and
do, the java will only work when its in the page, otherwise I get the
error Object Expected.

The test code I have been trying is:

<html>
<head>
<Script src="bin/Test.js" type="text/javascript"></script>
</head>
<body onLoad="testFunction();">
</body>
</html>

and test function is:

function testFunction()
{
alert('test');
}

thanks for any help.

I am developing with ASP.NET V1.1
Jul 20 '06 #12

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

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
44
by: Xah Lee | last post by:
here's a large exercise that uses what we built before. suppose you have tens of thousands of files in various directories. Some of these files are identical, but you don't know which ones are...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
18
by: JKop | last post by:
Here's what I know so far: You have a C++ project. You have source files in it. When you go to compile it, first thing the preprocessor sticks the header files into each source file. So now...
3
by: pooja | last post by:
Suppose i have created a class c1 with f1()in c1.cpp and included this c1.cpp in file1.cpp file , which is also having main() by giving the statement #include "c1.cpp". the same i can do by...
11
by: ambika | last post by:
Iam just trying to know "c". And I have a small doubt about these header files. The header files just contain the declaration part...Where is the definition for these declarations written??And how...
22
by: Daniel Billingsley | last post by:
Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes it could get some honest attention. VB6 had a some simple and fast mechanisms for retrieving values from basic text...
18
by: UJ | last post by:
Folks, We provide custom content for our customers. Currently we put the files on our server and people have a program we provide that will download the files. These files are usually SWF, HTML or...
0
by: wal | last post by:
How does one attach files to emails using libgmail? The following code http://pramode.net/articles/lfy/fuse/4.txt works fine when said files are simple text files, but it failes as soon as the...
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.