×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    32

    How to call a function from one javascript to another js file

    Hi all,

    index.html:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type="text/javascript" src="basic.js"></script>
    <script type="text/javascript" src"LocateMe.js"></script>
    <script type="text/javascript" src="WRTKit/WRTKit.js"></script>
    <style type="text/css">
    @import "basic.css";
    </style>
    <META NAME="Generator" CONTENT="Nokia WRT plug-in for Aptana Studio 2.0.0" />
    </head>
    <body onload="init()">
    </body>

    </html>

    basic.js
    var LocateMe = null;

    // Called from the onload event handler to initialize the widget.
    function init() {
    LocateMe = new LocateMe();
    LocateMe.alert();
    }


    LocateMe.js
    // Constructor.
    function LocateMe(){
    alert("In cosnt");
    }

    LocateMe.prototype.alert = function()
    {
    alert("In countrycode");

    }

    I have both basic.js & LocateMe.js in the same path.

    When i execute i get runtime error that Locateme is not a contructor.

    How should i access function across js ( java scripts ).

    I want to split my code into different js files and call functions across js files.
    Thanks,
    Mani

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    32

    Re: How to call a function from one javascript to another js file

    Has anyone tried like this ?

    - mani

Similar Threads

  1. Replies: 8
    Last Post: 2008-12-03, 02:25
  2. Problem with GCCE build in Carbide.vs
    By raffaelbechara in forum Symbian
    Replies: 6
    Last Post: 2008-10-20, 16:06
  3. how to call the function in another file?
    By krgvs in forum Symbian
    Replies: 8
    Last Post: 2008-01-05, 13:27
  4. Replies: 1
    Last Post: 2005-05-26, 14:22
  5. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×