aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to call a javascript function which is in another .js file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to call a javascript function which is in another .js file" Watch "How to call a javascript function which is in another .js file" New topic
Author

How to call a javascript function which is in another .js file

suneel kota
Greenhorn

Joined: Jun 06, 2006
Posts: 24
Hi All,


How to call a javascript function in a html page which is in another .js file.

Regards
SuneelKota
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42635
    
  65
JavaScript only has single global namespace for all functions. If the page includes both JS files, then you can just call the function by its name.


Ping & DNS - my free Android networking tools app
Liebes Maschine
Greenhorn

Joined: Dec 28, 2006
Posts: 2
Hi,
i tried the same thing. i'm trying to call a javascript function present in a common JS file from a jsp, having declared it's src before this call, in the jsp. this fn in turn calls another specific JS fn, contained in another JS file, also declared with src in the original JSP file. for some reason, this sequence is not returning the right boolean value, while using a function by the same name in the JSP itself works.
any idea what's going wrong?
thanks in advance...
Liebes Maschine
Greenhorn

Joined: Dec 28, 2006
Posts: 2
oh, and i've declared them in the right order - from innermost to outermost in calling order...
 
Consider Paul's rocket mass heater.
 
subject: How to call a javascript function which is in another .js file