Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 738959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:20:44+00:00 2026-05-14T08:20:44+00:00

In my main Web Page (Viewer.aspx) I have a javascript script tag like this

  • 0

In my main Web Page (Viewer.aspx) I have a javascript script tag like this

<script language="javascript" type="text/javascript">

function initialize() {
     var map = $find('Map1');           
     map.add_mouseMove(mouseMove);  

 }

</script>

Within those script tags I have a function. Is it possible to call another function that is in a different script tag like this?

<script language="javascript" type="text/javascript" src="Resources/JavaScript/proj4js-combined.js">

function mouseMove(sender,eventArgs) {
     var source = new Proj4js.Proj('EPSG:3116');
        var dest = new Proj4js.Proj('WGS84');

        var p = new Proj4js.Point(px, py);
        Proj4js.transform(source, dest, p);    
 }

</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:20:44+00:00Added an answer on May 14, 2026 at 8:20 am

    As per your comment, here’s what T.J. was talking about – you need to turn your second script block into something like this:

    <script type="application/javascript" src="Resources/JavaScript/proj4js-combined.js"></script>
    <script type="application/javascript">
    
    function mouseMove(sender,eventArgs) {
         var source = new Proj4js.Proj('EPSG:3116');
            var dest = new Proj4js.Proj('WGS84');
    
            var p = new Proj4js.Point(px, py);
            Proj4js.transform(source, dest, p);    
     }
    
    </script>
    

    …but you should really just move the inline code block (what’s inside of the 2nd <script> tag in my answer) to an external Javascript file.


    Edit 1: What’s the programming background you’re coming from? If it’s something like C# or Java, you’ll need to forget what you know about those and approach Javascript completely differently. Javascript is an interpreted language, not a compiled one; among other things, this means that the order in which your functions are declared matters.

    When I say “function declaration,” I mean anything that looks like this:

    function myNewFunction()
    {
       // anything else here
    }
    

    This tells the Javascript interpreter about a new function, called myNewFunction, whose body consists of whatever is in the curly braces.

    Here’s an example of what I’m talking about when I say you are using a function before you’ve declared it. Consider the following block of code (in isolation from any other Javascript, say, in an external Javascript file):

    function foo() // this line declares the function called "foo"
    {
    
    }
    
    function bar() // this line declares the function called "bar"
    {
        foo(); // this line invokes the previously declared function called "foo"
    }
    

    This will work as expected, because foo() was declared before you called it. However, what (it sounds like) you’re trying to do is analogous to this:

    function foo() // this line declares the function called "foo"
    {
        bar(); // this line tries to invoke the function called "bar"
               // but it hasn't been declared yet! so it's undefined
    }
    
    function bar() // this line declares the function called "bar"
    {
    
    }
    

    If you were to run this second Javascript snippet, it wouldn’t work, because you’re calling a function before it was declared.*

    *Footnote: this is not actually the case, because using this syntax (function foo() { ... }) does something special and magical in Javascript. My particular example will actually work, but it illustrates the problem you’re having.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this web application using Spring Web Flow framework. In my main page
i have web page it has a page header content like main menu,logo and
I have web service which return json string like : d={main0ID:abc.es/main,main1ID:ah/main} I wanna append
I have a web-view running JavaScript application, and sometimes it freezes/hangs when the main
I have a one-way WCF service, which main purpose is to get Web Page
I have this web page I'm developing that displays multiple images of one product
This is for a simple web-page assignment. I have a few pages on which
I have a bunch (currently) HyperlinkButtons on my main web page. I want to
I have a web page with the main menu on the top. Then on
I have a simple web page that has 3 tabs in my main content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.