473,386 Members | 1,798 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,386 software developers and data experts.

Using .js files rather than embedded js

I am trying to migrate from lots of javascript embedded within an aspx file
to using .js files.

So far no luck. I have created the .js file which contains part of the
javascript which was part of the aspx file and worked correctly.

First it seems that I cannot get what should exist in the .js file. I
assume although finding real examples on the net is more difficult than I
thought. My .js file contains 3 functions. There is no script tag.

I then (although I have tried the RegisterClientScriptBlock method) to
simply put the following into the <head

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

Now when I run I get that wonderful "A Runtime Error has occured. Do you
wish to debug? Line 3 Error Syntax error". Of course what is line 3????

Right now I am stuck.

Thanks
Lloyd Sheen

Dec 10 '07 #1
6 1034
On Dec 10, 10:13 am, "Lloyd Sheen" <a...@b.cwrote:
I am trying to migrate from lots of javascript embedded within an aspx file
to using .js files.

So far no luck. I have created the .js file which contains part of the
javascript which was part of the aspx file and worked correctly.

First it seems that I cannot get what should exist in the .js file. I
assume although finding real examples on the net is more difficult than I
thought. My .js file contains 3 functions. There is no script tag.

I then (although I have tried the RegisterClientScriptBlock method) to
simply put the following into the <head

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

Now when I run I get that wonderful "A Runtime Error has occured. Do you
wish to debug? Line 3 Error Syntax error". Of course what is line 3????

Right now I am stuck.
Line 3 is probably in your .js file. Sounds like a syntax error to
me. Perhaps you're missing a paren. Can you post some of your .js
file?

Dec 10 '07 #2
Line 3 - sounds to me like whatever was on Line 3 of your script.js file. Did
you remote the "<script>" tags from the file? If it's an include from a src=
attribute, you don't want them in the actual file.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"Lloyd Sheen" wrote:
I am trying to migrate from lots of javascript embedded within an aspx file
to using .js files.

So far no luck. I have created the .js file which contains part of the
javascript which was part of the aspx file and worked correctly.

First it seems that I cannot get what should exist in the .js file. I
assume although finding real examples on the net is more difficult than I
thought. My .js file contains 3 functions. There is no script tag.

I then (although I have tried the RegisterClientScriptBlock method) to
simply put the following into the <head

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

Now when I run I get that wonderful "A Runtime Error has occured. Do you
wish to debug? Line 3 Error Syntax error". Of course what is line 3????

Right now I am stuck.

Thanks
Lloyd Sheen

Dec 10 '07 #3

"Peter Bromberg [C# MVP]" <pb*******@yahoo.NoSpamMaam.comwrote in message
news:BA**********************************@microsof t.com...
Line 3 - sounds to me like whatever was on Line 3 of your script.js file.
Did
you remote the "<script>" tags from the file? If it's an include from a
src=
attribute, you don't want them in the actual file.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"Lloyd Sheen" wrote:
>I am trying to migrate from lots of javascript embedded within an aspx
file
to using .js files.

So far no luck. I have created the .js file which contains part of the
javascript which was part of the aspx file and worked correctly.

First it seems that I cannot get what should exist in the .js file. I
assume although finding real examples on the net is more difficult than I
thought. My .js file contains 3 functions. There is no script tag.

I then (although I have tried the RegisterClientScriptBlock method) to
simply put the following into the <head

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

Now when I run I get that wonderful "A Runtime Error has occured. Do you
wish to debug? Line 3 Error Syntax error". Of course what is line 3????

Right now I am stuck.

Thanks
Lloyd Sheen

I had 3 functions in one .js file. When I took 2 of them out and put them
back into the aspx file I had no problem.

Is there a way to put more than one function into a .js file. I am doing
this (one to learn) and mostly to make the aspx file more readable.

Thanks
Lloyd Sheen

Dec 10 '07 #4
"Lloyd Sheen" <a@b.cwrote in message
news:Oe**************@TK2MSFTNGP05.phx.gbl...
I had 3 functions in one .js file. When I took 2 of them out and put them
back into the aspx file I had no problem.

Is there a way to put more than one function into a .js file. I am doing
this (one to learn) and mostly to make the aspx file more readable.

You can have as many as you like...

Just make sure that each is correctly parenthesised e.g.

function firstFunction()
{

}

function secondFunction()
{

}

And remember not to include any <scripttags...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Dec 10 '07 #5

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:ug**************@TK2MSFTNGP02.phx.gbl...
"Lloyd Sheen" <a@b.cwrote in message
news:Oe**************@TK2MSFTNGP05.phx.gbl...
>I had 3 functions in one .js file. When I took 2 of them out and put
them back into the aspx file I had no problem.

Is there a way to put more than one function into a .js file. I am doing
this (one to learn) and mostly to make the aspx file more readable.


You can have as many as you like...

Just make sure that each is correctly parenthesised e.g.

function firstFunction()
{

}

function secondFunction()
{

}

And remember not to include any <scripttags...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Thanks Marc,

It was an script tag in the file. I will attribute this to monday morning.

This make my aspx file much easier to deal with and the javascript most of
which works fine be isolated so that I can find the areas that need changes
much faster.

Lloyd Sheen

Dec 10 '07 #6
"Lloyd Sheen" <a@b.cwrote in message
news:ue**************@TK2MSFTNGP05.phx.gbl...
Thanks Marc,
You're welcome Lloyt.
It was an script tag in the file.
I had a feeling it might be... :-)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Dec 10 '07 #7

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

Similar topics

1
by: Ruchika | last post by:
Hi, I want to build an embedded Visual C++ project from the python script. This is what I do - evc = r'"C:\Program Files\Microsoft eMbedded C++ 4.0\Common\EVC\Bin\EVC.EXE"' proj =...
8
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating...
18
by: Keith Brown | last post by:
I have an application that allows embedded storage of ANY chosen file in an OLE field. The file could have been dragged-and-dropped into the field or it might have been selected and imported...
13
by: Lou | last post by:
if I add a new item (Solution Items) to my project and its an icon(.ico), how can I reference that file when I am coding, Do I have to also add it to an image control, I don't want the file to be...
3
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and...
4
by: elmer.piano | last post by:
We have a directory of files on our ftp server. Is there a javacript to make a connection to the ftp server and compare files on a local drive and on the server? Files that have been changed or...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
5
by: DBC User | last post by:
I have a situation, where I need to add 4 or 5 data files (they change every time I build) in my project during build time and somehow I need a way to access these files during runtime. So I have...
2
by: Nathan Sokalski | last post by:
I am attempting to create icons for controls I have created using VB.NET by using the System.Drawing.ToolboxBitmap attribute. I have managed to do this in C# by specifying the path to the *.ico...
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.