473,327 Members | 2,012 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,327 software developers and data experts.

Central Javascript function file

Hi all,

I have several books on Javascript and, although they mention placing frequently used script
functions in a central file and calling them from, there they don't explain how to call them.

Can someone explain how I can call separate functions from a .js file that contains several
functions from different webpages as they are needed?

I've tried to do on my own it with no success.

TIA,

Susan
Jul 23 '05 #1
3 3237
In article <6%*****************@newsread2.news.pas.earthlink. net>,
Susan <Su****@bfd.net> wrote:
Hi all,

I have several books on Javascript and, although they mention placing
frequently used script
functions in a central file and calling them from, there they don't explain
how to call them.

Can someone explain how I can call separate functions from a .js file that
contains several
functions from different webpages as they are needed?

I've tried to do on my own it with no success.

TIA,

Susan


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

Functions in a .js file work exactely as they do inline.
function xxx(parm) {
statements
}

To call say "xxx(parm)"

I would not recommend putting all functions in one .js file since the
entire file is downloaded even if only one function is used. Group by
application.

--
Dennis Marks
http://www.dcs-chico.com/~denmarks/
To reply change none to dcsi.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #2
Dennis Marks wrote:
In article <6%*****************@newsread2.news.pas.earthlink. net>,
Susan <Su****@bfd.net> wrote:

Hi all,

I have several books on Javascript and, although they mention placing
frequently used script
functions in a central file and calling them from, there they don't explain
how to call them.

Can someone explain how I can call separate functions from a .js file that
contains several
functions from different webpages as they are needed?

I've tried to do on my own it with no success.

TIA,

Susan

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

Functions in a .js file work exactely as they do inline.
function xxx(parm) {
statements
}

To call say "xxx(parm)"

I would not recommend putting all functions in one .js file since the
entire file is downloaded even if only one function is used. Group by
application.

Thank you, Dennis...
Jul 23 '05 #3
JRS: In article <6%*****************@newsread2.news.pas.earthlink. net>,
seen in news:comp.lang.javascript, Susan <Su****@bfd.net> posted at Sun,
2 May 2004 02:26:10 :

Can someone explain how I can call separate functions from a .js file that
contains several
functions from different webpages as they are needed?


See <URL:http://www.merlyn.demon.co.uk/js-nclds.htm>.

NOTE that, while an include file will probably contain mostly functions,
it can contain any javascript, for example declarations and ordinary
statements. It should probably contain at least a little comment, at
least in the master copy.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #4

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

Similar topics

2
by: badd | last post by:
Hi, my problem is that i load an xml file (which displayed well in iexplorer standalone) with an asp file, and the page displays o instead of ő, u instead of ű, so my central european...
3
by: Brit | last post by:
Hello, I have been trying to include a js file from within another js file. I can get this to work for firefox, but not i.e. What I have is a.html ... <script language='JavaScript'...
9
by: Heather | last post by:
I have created a database application consisting of a front end and backend file. Data entry and administration of the application are done at a central location. The next requirement is to be able...
7
by: PC Datasheet | last post by:
Looking for suggestions ---- A database was designed for a national automobile inspection program. In it's simplest form, the database has two tables: TblOwner OwnerID <Year/Make/Model owned...
14
by: Rich | last post by:
I am converting my enterprise solution from VS 2003 (.NET v1.1.4322) to VS 2005 (.NET v2.0.50727). The entire solution uses serveral technologies - Windows Server 2003 (AD, SQL Server 2000, IIS,...
8
by: Frank | last post by:
Hi, I am working with VS.NET 2005 Ultimately, I wish to call a JavaScript function from a .js file
5
by: Priya | last post by:
Hey all, I have some values in the database which has to retrieved and then passed on to some functions in the javascript. The javascript file is a separate file. I have included it in the aspx...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...

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.