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

Functions in a .js file

52
Hello everyone,

I was wondering how i could call a function in a .js file from my html document. the call is going to come from a onchange event.

Any help will be appreciated.
Mar 26 '08 #1
2 1106
pronerd
392 Expert 256MB
It does not work any differently than calling JS functions that are in the page. You will need to have a script tag on the page pointing to the remote .JS file so the page knows to load the file.

Expand|Select|Wrap|Line Numbers
  1. <script src="http://blahblah.com/scripts/someFile.js" language="javascript"   type="text/javascript"></script>
Mar 26 '08 #2
aswath
18
It does not work any differently than calling JS functions that are in the page. You will need to have a script tag on the page pointing to the remote .JS file so the page knows to load the file.

Expand|Select|Wrap|Line Numbers
  1. <script src="http://blahblah.com/scripts/someFile.js" language="javascript"   type="text/javascript"></script>
[HTML]<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script language="javascript" src="file_name.js">
</script>
</head>
<body>
<form name="form">
<select name="select" onchange="call();">
<option value="hi">hi</option>
<option value="bye">bye</option>
</select>
</form>
</body>
</html>
[/HTML]

u js file as follows.......
Expand|Select|Wrap|Line Numbers
  1. function call()
  2. {
  3.     alert("u called me buddy");
  4. }
i hope this helps.....
regards
Mar 27 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Erwin Moller | last post by:
Hi group, I have an includefile that I (ahum) include in many scripts. It contains only functions I need now and then. Now I was wondering how things work behind the scenes. Is the whole...
7
by: Nolan Martin | last post by:
is a static functions address constant? ie.. static void func(); write_to_file(&func); Restart program... static void func(); void (*funcPtr) ();
7
by: Srini | last post by:
Hello, Rules for inline functions say that they have to be defined in the same compilation unit as their declarations. For class member functions this means that the inline member functions must...
17
by: cwdjrxyz | last post by:
Javascript has a very small math function list. However there is no reason that this list can not be extended greatly. Speed is not an issue, unless you nest complicated calculations several levels...
7
by: Tim ffitch | last post by:
Hi I have created a VB dll file that contains common functions I use across various projects in VB, Access and Excel. Rather than have to code the functions in each I decided to use the dll...
4
by: John Goche | last post by:
Hello, I have been going through several header source files which define classes with inline functions. In the case where the inline functions are not defined in place, the inline functions...
0
hqprog
by: hqprog | last post by:
Having search extensively I've learned the two functions timegm and gmtime_r though in the GNU standard C library extend the ISO standard. I need to use these two functions in myprog.c (on pc - ...
4
by: none | last post by:
Hi, I am wondering if anyone has some insight into a way to get the names of the functions that are defined in a C header file. What I am trying to do is develop tests for a large amount of C...
4
by: Bo Berglund | last post by:
I have defined a few functions in a file, let's say it is called functions.cpp. There are no objects involved, these are pure simple functions. In my test application I want to call this...
80
by: nicolas.sitbon | last post by:
Hi everybody, in a french C book, the author says that only {fgetc, getc, getchar, fgetwc, getwc, getwchar, fgets, gets, fgetws, getws, fputc, putc, putchar, fputwc, putwc, putwchar, fputs, puts,...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.