473,756 Members | 3,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3255
In article <6%************ *****@newsread2 .news.pas.earth link.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.earth link.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.earth link.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.demo n.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.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.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
2051
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 characters are changed. the xml well formed, and well encoded. i hope ;) <?xml version="1.0" encoding="ISO-8859-2"?> <tests>
3
11826
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' src='b.js'></script><script>Function();</script> b.js .... function Function() {
9
2128
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 to distribute the appllication each month to five remote sites by sending the sites a CD. The sites will only use the application to lookup data in the database and print reports. The sites will make no data entry. I need comments and suggestions...
7
2429
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 by owner, Owner name/address, etc) TblInspection InspectionID
14
25636
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, ASP.NET, ASP.NET Mobile) Windows Mobile 2003 (Pocket IE) I have completed a portion of the conversion (ASP.NET Mobile pages for PIE, and some of the ASP.NET-bases web services), and while testing I have a runtime error that did not exist in the...
8
2608
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
20391
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 page using the src option. How do I pass the values that I get from the database to javascript ? Any help would be appreciated.
0
9275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.