Load an External Javascript Function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • makthar
    New Member
    • Aug 2007
    • 13

    Load an External Javascript Function

    Hi

    I have a javascript file called external1.js . This file has a function say function1.
    In the function I need to make a call to external2 javscipt file(external2. js) function.

    the sample code is
    external1.js
    Code:
    function1
    {
     .........
    function2()// this function is defined in external2.js
    .................
    }
    external2.js
    Code:
    function2
    {
    ................
    ................
    .................
    }
    How do i achieve this functionality

    Thank u
    Mansoor.
  • markrawlingson
    Recognized Expert Contributor
    • Aug 2007
    • 346

    #2
    Although I'm not a fan of having any more than 1 external stylesheet or javascript file, you could Include both external references on your page(s) to obtain the desired effect.

    Sincerely,
    Mark

    Comment

    • makthar
      New Member
      • Aug 2007
      • 13

      #3
      Hi

      Thanks for the Reply. But i think that u haven't got my question correctly. The problem is that the jsp makes a call to the external js external1.js, and one of the functions in external1.js makes a call to a function defined in another external javascript file external2.js.

      Thank U
      Mansoor.

      Comment

      • epots9
        Recognized Expert Top Contributor
        • May 2007
        • 1352

        #4
        when you include the files it should be like this:
        [html]
        <script type="text/javascript" src="external1. js"></script>
        <script type="text/javascript" src="external2. js"></script>
        [/html]

        can u can do function calls to the functions inside the other file, i done this in my code.
        Also make sure you have a doctype.

        good luck

        Comment

        Working...