473,385 Members | 1,893 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.

Accessing embedded javascript function from external js file

13
Hi

I need to call a javascript function defined in a html file from a javascript function defined in an external javascript file(.js). Can anyone suggest me how do i do/acheive this functionality.

thank u
Mansoor
Aug 14 '07 #1
5 2848
epots9
1,351 Expert 1GB
i've done something similar to this, just declare the html embed javascript before the external javascript.

[html]
<script type="text/javascript">
function abc()
{
...
}
...
</script>
<script type="text/javascript" src="myScript.js"></script>
[/html]
Aug 14 '07 #2
pbmods
5,821 Expert 4TB
Changed thread title to better describe the problem (did you know that thread titles that do not follow the Posting Guidelines actually get FEWER responses?).
Aug 14 '07 #3
makthar
13
Hi Epots

what i actually meant was i have a javascript file say name.js , in this i have a function getName() which in turn calls a javascript function called getFullname() which is defined in a file called display.html

Thanks
Mansoor
Aug 14 '07 #4
epots9
1,351 Expert 1GB
Hi Epots

what i actually meant was i have a javascript file say name.js , in this i have a function getName() which in turn calls a javascript function called getFullname() which is defined in a file called display.html

Thanks
Mansoor
if u follow my method above, all u have to do is call the function

Expand|Select|Wrap|Line Numbers
  1. getFullname();
  2.  
the external javascript will be able to access the embeded javascript functions.
Aug 14 '07 #5
acoder
16,027 Expert Mod 8TB
Hi Epots

what i actually meant was i have a javascript file say name.js , in this i have a function getName() which in turn calls a javascript function called getFullname() which is defined in a file called display.html

Thanks
Mansoor
I know this is not a solution, but are you sure you want to do it like this? One of the advantages of external Javascript files are their possibility of re-use.

You should try to put all Javascript (if possible) into external files. Try to make the functions as generic as possible. Obviously, the function calls will be specific to the page. You could put these in their own file.

In your case, you should move getFullname() into an external .js file and you won't need to worry about this problem.
Aug 15 '07 #6

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

Similar topics

1
by: John B. | last post by:
In an effort to turn a little more a module with my pages, I would like to turn my internal javascripts into an external javascript files to supply the information onto a web page. I...
4
by: comcast news | last post by:
at least i think it this is the problem am trying to fix a webpage/javascript that i didn't write www.deltaneutral.com when invoked or any new page from the menu, get the error msg line 2...
2
by: Rick | last post by:
Hi.. I've got some code I wrote in PHP that will generate an HTML page with embedded javascript which in turn creates a new argument string for the browser, but the xhtml parser in Firefox and...
4
by: roger31 | last post by:
Hello - i have created a simple composite control with drop down list displaying the US States. I have also a Javascript (County.js) file embedded inside the control. The Javascript file has an...
4
by: Neo Geshel | last post by:
I am experiencing a collision between two scripts, but I cannot find where it is. I am hoping that someone here can help me. I have two external JS files that I call into each web page. One...
1
by: Brian Kendig | last post by:
I've got some questions about using an external javascript file, included via '<script type="text/javascript" src="mycode.js" ></ script>': (1) If I define a function "myFunction()" in the...
4
by: EvrimAgha | last post by:
Hi I am using an external JavaScript file that should handle number of similar forms and form elements on different html pages. What I need to do is , pass the name of the form, the two text...
1
by: jmc | last post by:
The short version: Is there a way to get embedded styles to work on files that are displayed in a page using the shtml Include method? My work intranet site uses Front Page dynamic templates. ...
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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...

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.