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 8834475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:01:32+00:00 2026-06-14T09:01:32+00:00

Is it possible to load the functions from separate Javascript files dynamically when a

  • 0

Is it possible to load the functions from separate Javascript files dynamically when a window loads, by setting an array and loader function?

  • 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-06-14T09:01:34+00:00Added an answer on June 14, 2026 at 9:01 am

    The easiest way is to simply add <script> elements to the DOM dynamically.

    <script>
    var scripts = [ 'a.js', 'b.js', ... ];
    for (var i = 0; i < scripts.length; ++i) {
      document.write('<script src="' + scripts[i] + '"></' + 'script>');
    }
    </script>
    

    Note that you can only do this before the DOMContentReady event is fired.

    BTW event Google Closure Library uses this technique. And as a sidenote, you probably want to concatenate the scripts into a single file so that you save yourself (and your users) HTTP requests and get faster page loads.

    What’s cool about this is that the scripts are downloaded and evaluated right after the closing </script> tag so you don’t have to wait for anything else before you can use them:

    <!-- Let's pretend that a.js defines a function A() -->
    <script>document.write('<script src="a.js"></' + 'script>');</script>
    <script>
    var a = new A();
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to load images from an array in jQuery? The array looks
Is it possible in php to load a function, say from a external file
is it possible to load multiple swf files directly on top of each other?
Is it possible to load an html document into a DOM javascript object so
Is it possible to load new lines from a text file to variables in
Is it possible to load a single plugin from outside the cake root using
In modern processors it is possible to load a register from memory and then
I need to use a javascript function from an external js file inside another
Hey haskellers and haskellettes, is it possible to load a module functions in a
I am calling python functions from C++. I was wondering if it is possible

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.